diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 38b75c28..1c3ade80 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1025,20 +1025,20 @@ class ResMrpWorkOrder(models.Model): # 查询工序最小的非完工、非返工的装夹预调工单 work_id = self.search( [('production_id', '=', workorder.production_id.id), - ('routing_type', '=', '装夹预调'), ('state', 'not in', ['rework', 'done', 'cancel'])], limit=1, order="sequence") - if workorder == work_id: - if workorder.production_id.reservation_state == 'assigned': - workorder.state = 'ready' - elif workorder.production_id.reservation_state != 'assigned': - workorder.state = 'waiting' - continue - elif (workorder.name == '装夹预调' and - workorder.state not in ['rework', 'done', 'cancel']): - if workorder.state != 'pending': - workorder.state = 'pending' + if work_id.routing_type == '装夹预调': + if workorder == work_id: + if workorder.production_id.reservation_state == 'assigned': + workorder.state = 'ready' + elif workorder.production_id.reservation_state != 'assigned': + workorder.state = 'waiting' + continue + elif (workorder.name == '装夹预调' and + workorder.state not in ['rework', 'done', 'cancel']): + if workorder.state != 'pending': + workorder.state = 'pending' if workorder.production_id.tool_state in ['1', '2'] and workorder.state == 'ready': workorder.state = 'waiting' continue