From ed50d7c9a798453c46ebc3cf00eb2527dbf609e5 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Mon, 12 May 2025 14:55:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=8B=A8=E5=8D=95=E5=B0=B1=E7=BB=AA?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 5 ++--- sf_manufacturing/models/purchase_order.py | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 35cd2234..df303c9c 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1312,6 +1312,7 @@ class ResMrpWorkOrder(models.Model): else: workorder.state = 'ready' continue + continue # ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]========================== if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework' or workorder.production_id.schedule_state != '已排' @@ -1327,9 +1328,7 @@ 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 == '已编程': + if workorder.production_id.programming_state == '已编程': purchase_orders_id = self._get_surface_technics_purchase_ids() if purchase_orders_id: if purchase_orders_id.state == 'purchase': diff --git a/sf_manufacturing/models/purchase_order.py b/sf_manufacturing/models/purchase_order.py index 8fbd6c9d..d73e3f03 100644 --- a/sf_manufacturing/models/purchase_order.py +++ b/sf_manufacturing/models/purchase_order.py @@ -152,6 +152,8 @@ class PurchaseOrder(models.Model): for line in self.order_line: # 将产品不追踪序列号的行项目设置qty_done + if not line.move_ids: + continue if line.move_ids[0].product_id.tracking == 'none': line.move_ids[0].quantity_done = line.move_ids[0].product_qty return res