修复采购
This commit is contained in:
@@ -309,7 +309,8 @@ class MrpProduction(models.Model):
|
|||||||
for move in production.move_raw_ids if move.product_id):
|
for move in production.move_raw_ids if move.product_id):
|
||||||
production.state = 'progress'
|
production.state = 'progress'
|
||||||
# 新添加的状态逻辑
|
# 新添加的状态逻辑
|
||||||
if production.state in ['to_close', 'progress', 'technology_to_confirmed'] and production.schedule_state == '未排':
|
if production.state in ['to_close', 'progress',
|
||||||
|
'technology_to_confirmed'] and production.schedule_state == '未排':
|
||||||
if not production.workorder_ids or production.is_adjust is True:
|
if not production.workorder_ids or production.is_adjust is True:
|
||||||
production.state = 'technology_to_confirmed'
|
production.state = 'technology_to_confirmed'
|
||||||
else:
|
else:
|
||||||
@@ -356,7 +357,6 @@ class MrpProduction(models.Model):
|
|||||||
if production.tool_state == '2':
|
if production.tool_state == '2':
|
||||||
production.state = 'rework'
|
production.state = 'rework'
|
||||||
|
|
||||||
|
|
||||||
# 退回调整
|
# 退回调整
|
||||||
def technology_back_adjust(self):
|
def technology_back_adjust(self):
|
||||||
process_parameters = []
|
process_parameters = []
|
||||||
@@ -849,10 +849,15 @@ class MrpProduction(models.Model):
|
|||||||
purchase_order = self.env['purchase.order'].search(
|
purchase_order = self.env['purchase.order'].search(
|
||||||
[('state', '=', 'draft'), ('origin', '=', item.name),
|
[('state', '=', 'draft'), ('origin', '=', item.name),
|
||||||
('purchase_type', '=', 'consignment')])
|
('purchase_type', '=', 'consignment')])
|
||||||
for line in purchase_order.order_line:
|
|
||||||
server_template = self.env['product.template'].search(
|
server_template = self.env['product.template'].search(
|
||||||
[('server_product_process_parameters_id', '=', workorder.surface_technics_parameters_id.id),
|
[('server_product_process_parameters_id', '=',
|
||||||
|
workorder.surface_technics_parameters_id.id),
|
||||||
('detailed_type', '=', 'service')])
|
('detailed_type', '=', 'service')])
|
||||||
|
for po in purchase_order:
|
||||||
|
for line in po.order_line:
|
||||||
|
if line.product_id == server_template.product_variant_id:
|
||||||
|
continue
|
||||||
|
if server_template.server_product_process_parameters_id != line.product_id.server_product_process_parameters_id:
|
||||||
purchase_order_line = self.env['purchase.order.line'].search(
|
purchase_order_line = self.env['purchase.order.line'].search(
|
||||||
[('product_id', '=', server_template.product_variant_id.id), ('id', '=', line.id),
|
[('product_id', '=', server_template.product_variant_id.id), ('id', '=', line.id),
|
||||||
('product_qty', '=', 1)], limit=1, order='id desc')
|
('product_qty', '=', 1)], limit=1, order='id desc')
|
||||||
@@ -898,8 +903,6 @@ class MrpProduction(models.Model):
|
|||||||
for cw in cancel_work_ids:
|
for cw in cancel_work_ids:
|
||||||
cw.sequence = sequence + 1
|
cw.sequence = sequence + 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _reset_work_order_sequence_1(self):
|
def _reset_work_order_sequence_1(self):
|
||||||
"""
|
"""
|
||||||
工单工序排序方法(旧)
|
工单工序排序方法(旧)
|
||||||
|
|||||||
@@ -265,17 +265,20 @@ class RePurchaseOrder(models.Model):
|
|||||||
}))
|
}))
|
||||||
for purchase in purchase_order:
|
for purchase in purchase_order:
|
||||||
for po in purchase.order_line:
|
for po in purchase.order_line:
|
||||||
if server_template.server_product_process_parameters_id == pp.surface_technics_parameters_id:
|
if po.product_id == server_template.product_variant_id:
|
||||||
|
continue
|
||||||
|
if server_template.server_product_process_parameters_id != po.product_id.server_product_process_parameters_id:
|
||||||
purchase_order_line = self.env['purchase.order.line'].search(
|
purchase_order_line = self.env['purchase.order.line'].search(
|
||||||
[('product_id', '=', server_template.product_variant_id.id),
|
[('product_id', '=', server_template.product_variant_id.id),
|
||||||
('product_qty', '=', 1.0), ('id', '=', po.id)], limit=1,
|
('product_qty', '=', 1.0), ('id', '=', purchase.id)], limit=1,
|
||||||
order='id desc')
|
order='id desc')
|
||||||
if not purchase_order_line and purchase not in purchase_order:
|
if not purchase_order_line:
|
||||||
server_product_process.append((0, 0, {
|
server_product_process.append((0, 0, {
|
||||||
'product_id': server_template.product_variant_id.id,
|
'product_id': server_template.product_variant_id.id,
|
||||||
'product_qty': 1,
|
'product_qty': 1,
|
||||||
'product_uom': server_template.uom_id.id
|
'product_uom': server_template.uom_id.id
|
||||||
}))
|
}))
|
||||||
|
|
||||||
if server_product_process:
|
if server_product_process:
|
||||||
self.env['purchase.order'].sudo().create({
|
self.env['purchase.order'].sudo().create({
|
||||||
'partner_id': server_template.seller_ids[0].partner_id.id,
|
'partner_id': server_template.seller_ids[0].partner_id.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user