修复采购

This commit is contained in:
jinling.yang
2024-11-28 18:01:29 +08:00
parent 805eabd07e
commit deb2f6ca64
2 changed files with 22 additions and 16 deletions

View File

@@ -309,7 +309,8 @@ class MrpProduction(models.Model):
for move in production.move_raw_ids if move.product_id):
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:
production.state = 'technology_to_confirmed'
else:
@@ -356,7 +357,6 @@ class MrpProduction(models.Model):
if production.tool_state == '2':
production.state = 'rework'
# 退回调整
def technology_back_adjust(self):
process_parameters = []
@@ -849,15 +849,20 @@ class MrpProduction(models.Model):
purchase_order = self.env['purchase.order'].search(
[('state', '=', 'draft'), ('origin', '=', item.name),
('purchase_type', '=', 'consignment')])
for line in purchase_order.order_line:
server_template = self.env['product.template'].search(
[('server_product_process_parameters_id', '=', workorder.surface_technics_parameters_id.id),
('detailed_type', '=', 'service')])
purchase_order_line = self.env['purchase.order.line'].search(
[('product_id', '=', server_template.product_variant_id.id), ('id', '=', line.id),
('product_qty', '=', 1)], limit=1, order='id desc')
if purchase_order_line:
line.unlink()
server_template = self.env['product.template'].search(
[('server_product_process_parameters_id', '=',
workorder.surface_technics_parameters_id.id),
('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(
[('product_id', '=', server_template.product_variant_id.id), ('id', '=', line.id),
('product_qty', '=', 1)], limit=1, order='id desc')
if purchase_order_line:
line.unlink()
def _reset_work_order_sequence(self):
"""
@@ -898,8 +903,6 @@ class MrpProduction(models.Model):
for cw in cancel_work_ids:
cw.sequence = sequence + 1
def _reset_work_order_sequence_1(self):
"""
工单工序排序方法(旧)