空值判断
This commit is contained in:
@@ -1383,7 +1383,16 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
boolean = True
|
boolean = True
|
||||||
if not boolean:
|
if not boolean:
|
||||||
raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name)
|
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校验
|
# cnc校验
|
||||||
if self.production_id.production_type == '自动化产线加工':
|
if self.production_id.production_type == '自动化产线加工':
|
||||||
cnc_workorder = self.search(
|
cnc_workorder = self.search(
|
||||||
|
|||||||
Reference in New Issue
Block a user