1、功能刀具状态备注值自动计算方法优化

This commit is contained in:
yuxianghui
2024-07-28 16:23:17 +08:00
parent 6643684e9b
commit e84842d0a3
2 changed files with 9 additions and 5 deletions

View File

@@ -38,10 +38,13 @@ class MrpProduction(models.Model):
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)
work_ids = workorder_ids.filtered(lambda a: a.tool_state == '1' and a.state not in ['rework'])
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