diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 0ad53892..23129578 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1051,6 +1051,17 @@ class ResMrpWorkOrder(models.Model): if workorder.production_id.tool_state in ['1', '2'] and workorder.state == 'ready': workorder.state = 'waiting' continue + if (workorder.production_id.tool_state in ['1', '2'] + and not workorder.production_id.workorder_ids.filtered(lambda a: a.sequence == 0) + and workorder.production_id.programming_state == '编程中' and workorder.name == '装夹预调'): + if workorder.state == 'pending' and workorder == self.search( + [('production_id', '=', workorder.production_id.id), + ('routing_type', '=', '装夹预调'), + ('state', 'not in', ['rework', 'done', 'cancel'])], + limit=1, + order="sequence"): + workorder.state = 'waiting' + continue # elif workorder.routing_type == 'CNC加工' and workorder.state not in ['done', 'cancel', 'progress', # 'rework']: