制造订单 工单回退

This commit is contained in:
liaodanlong
2025-02-20 15:38:37 +08:00
parent 162a1061de
commit 75460c5df6

View File

@@ -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]