[FIX] purchase: confirm of purchase orders with kit boms
When using phantom/kit boms, `action_confirm` on the move can lead to the move unlink, as new moves with the different parts of the product have been created. See `_action_explode` in `mrp/stock.py` The method `action_confirm` on `stock.move` returns the list of remaining moves. `force_assign` should therefore be performed on this new moves list, returned by `action_confirm`, rather than be performed on the moves list sent to `action_confirm` opw-660722
This commit is contained in:
@@ -337,7 +337,8 @@ class PurchaseOrder(models.Model):
|
||||
res = order._prepare_picking()
|
||||
picking = self.env['stock.picking'].create(res)
|
||||
moves = order.order_line.filtered(lambda r: r.product_id.type in ['product', 'consu'])._create_stock_moves(picking)
|
||||
moves.action_confirm()
|
||||
move_ids = moves.action_confirm()
|
||||
moves = self.env['stock.move'].browse(move_ids)
|
||||
moves.force_assign()
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user