From 9c47a6bdba0f81ff74c1df944d12d4d8e9f22939 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 29 Jul 2024 16:36:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=94=E5=B7=A5-cmm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/wizard/rework_wizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_manufacturing/wizard/rework_wizard.py b/sf_manufacturing/wizard/rework_wizard.py index 91b5b970..4525cb7f 100644 --- a/sf_manufacturing/wizard/rework_wizard.py +++ b/sf_manufacturing/wizard/rework_wizard.py @@ -132,7 +132,7 @@ class ReworkWizard(models.TransientModel): 'sequence_number': cmm_line.sequence_number, 'program_name': cmm_line.program_name, 'program_path': cmm_line.program_path, - 'ftp_path': item_line.program_path, + 'ftp_path': cmm_line.program_path, 'processing_panel': panel.name, 'program_create_date': datetime.strftime( cmm_line.program_create_date, From a81ad08740213c72e1d9871bb14a0eaf51a10ffb Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 29 Jul 2024 16:43:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=88=80=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 25 +++++++---------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index b99d1b25..6eff353d 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -36,17 +36,12 @@ class MrpProduction(models.Model): def _compute_tool_state_remark(self): for item in self: if item.workorder_ids: - work_ids = [] - for workorder_id in item.workorder_ids: - if workorder_id.tool_state == '1': - work_ids.append(workorder_id) - if work_ids: + workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工')) + if workorder_ids.filtered(lambda a: a.tool_state_remark): + work_ids = workorder_ids.filtered(lambda a: a.tool_state_remark) tool_state_remark = '' for work_id in work_ids: - if tool_state_remark == '': - tool_state_remark = f"{work_id.tool_state_remark}" - else: - tool_state_remark = f"{tool_state_remark}\n{work_id.tool_state_remark}" + tool_state_remark = f"{work_id.tool_state_remark}\n" item.tool_state_remark = tool_state_remark else: item.tool_state_remark = False @@ -56,16 +51,10 @@ class MrpProduction(models.Model): for item in self: if item.workorder_ids: tool_state = item.tool_state - work_ids_1 = [] - work_ids_2 = [] - for workorder_id in item.workorder_ids: - if workorder_id.tool_state == '2': - work_ids_2.append(workorder_id) - elif workorder_id.tool_state == '1': - work_ids_1.append(workorder_id) - if work_ids_2: + workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工')) + if workorder_ids.filtered(lambda a: a.tool_state == '2'): item.tool_state = '2' - elif work_ids_1: + elif workorder_ids.filtered(lambda a: a.tool_state == '1'): item.tool_state = '1' else: item.tool_state = '0'