修复“同一个产品多个制造订单时-只有一张制造订单有组件”

This commit is contained in:
mgw
2024-07-24 12:17:32 +08:00
parent dec85dc92f
commit d3e307d195
2 changed files with 2 additions and 2 deletions

View File

@@ -324,7 +324,6 @@ class WorkCenterBarcode(models.Model):
machine_tool_compensation_value_x = fields.Char('x补偿值', readonly=True)
machine_tool_compensation_value_y = fields.Char('y补偿值', readonly=True)
# 工单状态
delivery_records = fields.One2many('delivery.record', 'workorder_id', string="下发记录")

View File

@@ -34,8 +34,9 @@ class MrpProduction(models.Model):
@api.depends('workorder_ids.tool_state')
def _compute_tool_state(self):
# if self.workorder_ids:
for item in self:
if item:
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 == '2'):
item.tool_state = '2'