[FIX] stock: move: _update_reserved_quantity
When a move line is reserved on multiple quants, we increased it with the `taken_quantity` variable, which is used to know how much quantity we try to reserve in total for this move, not what is available on the quant. The amount to increase is obviously the one returned by `stock.quant` and is available in the loop.
This commit is contained in:
@@ -694,7 +694,7 @@ class StockMove(models.Model):
|
||||
for reserved_quant, quantity in quants:
|
||||
to_update = self.move_line_ids.filtered(lambda m: m.location_id.id == reserved_quant.location_id.id and m.lot_id.id == reserved_quant.lot_id.id and m.package_id.id == reserved_quant.package_id.id and m.owner_id.id == reserved_quant.owner_id.id)
|
||||
if to_update:
|
||||
to_update[0].with_context(bypass_reservation_update=True).product_uom_qty += self.product_id.uom_id._compute_quantity(taken_quantity, self.product_uom, rounding_method='HALF-UP')
|
||||
to_update[0].with_context(bypass_reservation_update=True).product_uom_qty += self.product_id.uom_id._compute_quantity(quantity, self.product_uom, rounding_method='HALF-UP')
|
||||
else:
|
||||
if self.product_id.tracking == 'serial':
|
||||
for i in range(0, int(quantity)):
|
||||
|
||||
Reference in New Issue
Block a user