diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index b074746f..d6c97eff 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -166,7 +166,11 @@ class ResMrpWorkOrder(models.Model): ('state', '!=', 'cancel') ]) moves.state = 'assigned' - move_lines.state = 'assigned' + external_assistance = move_lines.filtered( + lambda picking: picking.location_id.name != '外协线边仓' + ) + external_assistance.state = 'assigned' + # move_lines.state = 'assigned' self.time_ids.date_end = None cur_workorder.state = 'progress' cur_workorder.production_id.state = 'progress' @@ -182,6 +186,8 @@ class ResMrpWorkOrder(models.Model): finished_quants.quantity = 0 finish_move = next((move for move in moves if move.location_dest_id.name == '制造后'), None) finish_move.move_dest_ids.reserved_availability = 0 + finish_move.move_dest_ids.move_line_ids.state = 'draft' + finish_move.move_dest_ids.move_line_ids.unlink() # finish_move.move_dest_ids.move_line_ids.reserved_uom_qty = 0 else: next_workorder = sorted_workorders[position + 1]