From 683d79a4e3ad0b94d5d3d23160fe8c8dfe18a6f5 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Mon, 29 Jul 2024 17:03:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=88=B6=E9=80=A0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=9A=84=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7=E5=A4=87?= =?UTF-8?q?=E6=B3=A8=E5=AD=97=E6=AE=B5=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 6eff353d..e4dfb2a8 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -36,12 +36,15 @@ class MrpProduction(models.Model): def _compute_tool_state_remark(self): for item in self: if item.workorder_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) + workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ['rework', 'done', 'cancel']) + if workorder_ids.filtered(lambda a: a.tool_state == '1'): + work_ids = workorder_ids.filtered(lambda a: a.tool_state == '1') tool_state_remark = '' for work_id in work_ids: - tool_state_remark = f"{work_id.tool_state_remark}\n" + 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}" item.tool_state_remark = tool_state_remark else: item.tool_state_remark = False @@ -51,7 +54,7 @@ class MrpProduction(models.Model): for item in self: if item.workorder_ids: tool_state = item.tool_state - workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工')) + workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ['rework', 'done', 'cancel']) if workorder_ids.filtered(lambda a: a.tool_state == '2'): item.tool_state = '2' elif workorder_ids.filtered(lambda a: a.tool_state == '1'):