From 39d6c8ae24563ef4d1d3975032a55bba54f07f8f Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Thu, 16 Jan 2025 15:41:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=88=B6=E9=80=A0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=86=8D=E6=AC=A1=E8=BF=94=E5=B7=A5=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E8=BF=94=E5=B7=A5=E6=8C=89=E9=92=AE=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 6 +++--- sf_manufacturing/wizard/rework_wizard.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 7a6c494b..d7181fdf 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -1256,9 +1256,9 @@ class MrpProduction(models.Model): 'default_production_id': self.id, 'default_workorder_ids': workorder_ids.ids if workorder_ids.ids != [] else self.workorder_ids.ids, 'default_hidden_workorder_ids': ','.join(map(str, work_id_list)) if work_id_list != [] else '', - 'default_reprogramming_num': cloud_programming.get('reprogramming_num'), - 'default_programming_state': cloud_programming.get('programming_state'), - 'default_is_reprogramming': True if cloud_programming.get('programming_state') in ['已下发'] else False + 'default_reprogramming_num': cloud_programming.get('reprogramming_num') if cloud_programming else '', + 'default_programming_state': cloud_programming.get('programming_state') if cloud_programming else '', + 'default_is_reprogramming': True if cloud_programming and (cloud_programming.get('programming_state') in ['已下发']) else False } } diff --git a/sf_manufacturing/wizard/rework_wizard.py b/sf_manufacturing/wizard/rework_wizard.py index d7514a8a..a3ac96ed 100644 --- a/sf_manufacturing/wizard/rework_wizard.py +++ b/sf_manufacturing/wizard/rework_wizard.py @@ -281,7 +281,8 @@ class ReworkWizard(models.TransientModel): {'programming_state': '编程中', 'work_state': '编程中', 'is_rework': True}) # ================================================= if self.production_id.state == 'progress': - self.production_id.write({'programming_state': '已编程', 'work_state': '已编程'}) + if self.programming_state: + self.production_id.write({'programming_state': '已编程', 'work_state': '已编程'}) if self.reprogramming_num >= 1 and self.programming_state == '已编程': productions_not_delivered = self.env['mrp.production'].search( [('programming_no', '=', self.production_id.programming_no),