修复功能刀具
This commit is contained in:
@@ -36,17 +36,12 @@ class MrpProduction(models.Model):
|
|||||||
def _compute_tool_state_remark(self):
|
def _compute_tool_state_remark(self):
|
||||||
for item in self:
|
for item in self:
|
||||||
if item.workorder_ids:
|
if item.workorder_ids:
|
||||||
work_ids = []
|
workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工'))
|
||||||
for workorder_id in item.workorder_ids:
|
if workorder_ids.filtered(lambda a: a.tool_state_remark):
|
||||||
if workorder_id.tool_state == '1':
|
work_ids = workorder_ids.filtered(lambda a: a.tool_state_remark)
|
||||||
work_ids.append(workorder_id)
|
|
||||||
if work_ids:
|
|
||||||
tool_state_remark = ''
|
tool_state_remark = ''
|
||||||
for work_id in work_ids:
|
for work_id in work_ids:
|
||||||
if tool_state_remark == '':
|
tool_state_remark = f"{work_id.tool_state_remark}\n"
|
||||||
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
|
item.tool_state_remark = tool_state_remark
|
||||||
else:
|
else:
|
||||||
item.tool_state_remark = False
|
item.tool_state_remark = False
|
||||||
@@ -56,16 +51,10 @@ class MrpProduction(models.Model):
|
|||||||
for item in self:
|
for item in self:
|
||||||
if item.workorder_ids:
|
if item.workorder_ids:
|
||||||
tool_state = item.tool_state
|
tool_state = item.tool_state
|
||||||
work_ids_1 = []
|
workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工'))
|
||||||
work_ids_2 = []
|
if workorder_ids.filtered(lambda a: a.tool_state == '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:
|
|
||||||
item.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'
|
item.tool_state = '1'
|
||||||
else:
|
else:
|
||||||
item.tool_state = '0'
|
item.tool_state = '0'
|
||||||
|
|||||||
Reference in New Issue
Block a user