From 5b61a801c5a60188a8430835384ebdefd939aa44 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Wed, 14 May 2025 13:57:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=A9=BA=E5=80=BC=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 4180bcce..011482d9 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1383,7 +1383,16 @@ class ResMrpWorkOrder(models.Model): boolean = True if not boolean: raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name) - self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name + self.pro_code = False # 默认值 + if ( + self.production_id + and self.production_id.move_raw_ids + and len(self.production_id.move_raw_ids) > 0 + and self.production_id.move_raw_ids[0].move_line_ids + and len(self.production_id.move_raw_ids[0].move_line_ids) > 0 + and self.production_id.move_raw_ids[0].move_line_ids[0].lot_id + ): + self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name # cnc校验 if self.production_id.production_type == '自动化产线加工': cnc_workorder = self.search( From c6f06a4c321842af0237d23966c5ebd53f95868e Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Wed, 14 May 2025 14:12:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A4=96=E5=8D=8F=E8=B0=83=E6=8B=A8?= =?UTF-8?q?=E5=8D=95=E5=B0=B1=E7=BB=AA=E6=9D=A1=E4=BB=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/purchase_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_manufacturing/models/purchase_order.py b/sf_manufacturing/models/purchase_order.py index d79425de..d31a859f 100644 --- a/sf_manufacturing/models/purchase_order.py +++ b/sf_manufacturing/models/purchase_order.py @@ -126,7 +126,7 @@ class PurchaseOrder(models.Model): if not work_ids: continue min_sequence_wk = min(work_ids, key=lambda wk: wk.sequence) - if min_sequence_wk.is_subcontract: + if min_sequence_wk.is_subcontract and min_sequence_wk.state == 'ready': picking_id = production_id.picking_ids.filtered( lambda wk: wk.location_id.name == '制造前' and wk.location_dest_id.name == '外协加工区') move_out = picking_id.move_ids