changeset 1c540c621623 in modules/product_cost_fifo:5.6
details:
https://hg.tryton.org/modules/product_cost_fifo?cmd=changeset;node=1c540c621623
description:
Do not set fifo_quantity greater than quantity
issue9664
review328231002
(grafted from c21747a2ee8454812ecf5f8e1592a520225e8c20)
diffstat:
move.py | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diffs (13 lines):
diff -r c8105e34f32c -r 1c540c621623 move.py
--- a/move.py Wed Sep 16 14:33:46 2020 +0200
+++ b/move.py Wed Oct 21 23:33:28 2020 +0200
@@ -95,6 +95,9 @@
move_qty = Uom.compute_qty(self.product.default_uom, move_qty,
move.uom, round=False)
move.fifo_quantity = (move.fifo_quantity or 0.0) + move_qty
+ # Due to float, the fifo quantity result can exceed the quantity.
+ assert move.quantity >= move.fifo_quantity - move.uom.rounding
+ move.fifo_quantity = min(move.fifo_quantity, move.quantity)
to_save.append(move)
if to_save:
# TODO save in do method when product change