Round written quantity in ShipmentOut._sync_inventory_to_outgoing

Even with only subtraction, the result quantity may have rounding issue.

issue5754
review27521002
This commit is contained in:
Cédric Krier committed 2016-08-01 21:02:03 +02:00
1 parent daa3b48a85
commit 566c459a15
1 file changed
+4 -3
+4 -3
View File
@@ -147,13 +147,14 @@ class ShipmentOut:
values = {}
if quantity < out_quantity:
outgoing_moves.extend(Move.copy([out_move], default={
'quantity': out_quantity - quantity,
'quantity': out_move.uom.round(
out_quantity - quantity),
}))
values['quantity'] = quantity
values['quantity'] = out_move.uom.round(quantity)
values['lot'] = move.lot.id
to_write.extend(([out_move], values))
quantity -= out_quantity
assert quantity <= 0
assert move.uom.round(quantity) <= 0
if to_write:
Move.write(*to_write)