From 79d561ba683c6c7c2ef81ee34e6b7790fa8e0272 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Mon, 6 Jan 2025 13:01:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 26 ++++++++---------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 447c6da1..6cb177dc 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1058,18 +1058,16 @@ class ResMrpWorkOrder(models.Model): and workorder.production_id.schedule_state == '已排' and len(workorder.production_id.picking_ids.filtered( lambda w: w.state not in ['done', 'cancel'])) == 0): - workorder.state = 'ready' if workorder.is_subcontract is True: purchase_orders_id = self._get_surface_technics_purchase_ids() if purchase_orders_id.state == 'purchase': - move_out = workorder.move_subcontract_workorder_ids[1] - for mo in move_out: - if mo.state != 'done': - mo.write({'state': 'assigned', 'production_id': False}) + workorder.state = 'ready' continue - continue - else: - workorder.state = 'waiting' + else: + workorder.state = 'waiting' + continue + else: + workorder.state = 'ready' continue # ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]========================== if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework' @@ -1093,17 +1091,11 @@ class ResMrpWorkOrder(models.Model): if workorder.is_subcontract is False: workorder.state = 'ready' else: - if len(workorder.production_id.picking_ids.filtered( - lambda w: w.state not in ['done', - 'cancel'])) == 0 and workorder.production_id.programming_state == '已编程': - workorder.state = 'ready' purchase_orders_id = self._get_surface_technics_purchase_ids() if purchase_orders_id: - if purchase_orders_id.state == 'purchase': - move_out = workorder.move_subcontract_workorder_ids[1] - for mo in move_out: - if mo.state != 'done': - mo.write({'state': 'assigned', 'production_id': False}) + workorder.state = 'ready' if purchase_orders_id.state == 'purchase' else 'waiting' + else: + workorder.state = 'waiting' # 重写工单开始按钮方法 def button_start(self):