[FIX] stock: reserved qty, typo expected singleton

In 4322985a at one point several stock.move could be selected when we
just wanted the first one.

opw-1840719
closes #24538
This commit is contained in:
Nicolas Lempereur
2018-05-03 10:14:11 +02:00
parent d6050c9d07
commit fd44ff38a3
+1 -1
View File
@@ -877,7 +877,7 @@ class StockMove(models.Model):
to_update = self.move_line_ids.filtered(lambda m: m.product_id.tracking != 'serial' and
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(quantity, to_update.product_uom_id, rounding_method='HALF-UP')
to_update[0].with_context(bypass_reservation_update=True).product_uom_qty += self.product_id.uom_id._compute_quantity(quantity, to_update[0].product_uom_id, rounding_method='HALF-UP')
else:
if self.product_id.tracking == 'serial':
for i in range(0, int(quantity)):