From dbf75684ee3235a07bc7697cf5a0faeaa85f3f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Thu, 5 Dec 2024 13:42:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=B9=E6=AE=8A=E8=A1=A8=E9=9D=A2=E5=B7=A5?= =?UTF-8?q?=E8=89=BA=E5=B7=A5=E5=8D=95=E6=B2=A1=E6=9C=89=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E9=87=87=E8=B4=AD=E5=8D=95=E6=97=B6=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E5=A4=84=E4=BA=8E=E7=AD=89=E5=BE=85=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 11 ++++++++++- sf_manufacturing/models/stock.py | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 24bad9e7..b6173d78 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1098,7 +1098,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': + workorder.state = 'ready' + continue + 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' diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index e464e995..8597942f 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -701,7 +701,7 @@ class StockPicking(models.Model): moves_out.write( {'picking_id': picking_out.id, 'state': 'waiting'}) moves_out._assign_picking_post_process(new=new_picking) - return moves_in, moves_out + @api.depends('move_type', 'immediate_transfer', 'move_ids.state', 'move_ids.picking_id') def _compute_state(self):