diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 33795920..068431f8 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -122,7 +122,7 @@ class MrpProduction(models.Model): is_scrap = fields.Boolean('是否报废', default=False) @api.depends( - 'move_raw_ids.state', 'move_raw_ids.quantity_done', 'move_finished_ids.state', + 'move_raw_ids.state', 'move_raw_ids.quantity_done', 'move_finished_ids.state', 'tool_state', 'workorder_ids.state', 'product_qty', 'qty_producing', 'schedule_state') def _compute_state(self): for production in self: @@ -182,6 +182,9 @@ class MrpProduction(models.Model): for wo in production.workorder_ids): production.state = 'rework' + # 如果制造订单的功能刀具为【无效刀】则制造订单状态改为返工 + if production.tool_state == '2': + production.state = 'rework' def action_check(self): """ diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 0e4d4391..818df620 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -101,7 +101,7 @@ - +