From 39f99d6ce7d57ef2ac1be98fb0820103bf48f196 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Thu, 24 Oct 2024 16:04:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=B7=A5=E5=8D=95=E7=9A=84?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 23129578..01977926 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1105,9 +1105,11 @@ class ResMrpWorkOrder(models.Model): if self.routing_type == '装夹预调': # 判断是否有坯料的序列号信息 boolean = False - if self.production_id.move_raw_ids[0].move_line_ids: - if self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name: - boolean = True + if self.production_id.move_raw_ids: + if self.production_id.move_raw_ids[0].move_line_ids: + if self.production_id.move_raw_ids[0].move_line_ids: + if self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name: + 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