[FIX] mrp: unlink workorder lines in post_inventory()
Posting intermediate inventory in a manufacturing order using workorder need to delete all the remaining workorder lines. The post_inventory method create new raw moves for the remaining quantities then reserve those quantities. The reservation will create new workorder lines If the old workorder lines are not purged, the workorder will be asked to produced too much. closes odoo/odoo#32948 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
@@ -823,6 +823,8 @@ class MrpProduction(models.Model):
|
||||
order._cal_price(moves_to_do)
|
||||
moves_to_finish = order.move_finished_ids.filtered(lambda x: x.state not in ('done', 'cancel'))
|
||||
moves_to_finish = moves_to_finish._action_done()
|
||||
order.workorder_ids.mapped('raw_workorder_line_ids').unlink()
|
||||
order.workorder_ids.mapped('finished_workorder_line_ids').unlink()
|
||||
order.action_assign()
|
||||
consume_move_lines = moves_to_do.mapped('move_line_ids')
|
||||
for moveline in moves_to_finish.mapped('move_line_ids'):
|
||||
|
||||
Reference in New Issue
Block a user