changeset d22c29f6a03d in modules/product_cost_fifo:default
details: 
https://hg.tryton.org/modules/product_cost_fifo?cmd=changeset;node=d22c29f6a03d
description:
        Keep last cost price when quantity is zero

        When there is no quantity in stock, we keep the last cost price instead 
of
        setting it to zero. This gives the same behavior between on move 
computation
        and on product recomputation.

        issue9443
        review317771007
diffstat:

 product.py |  4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diffs (21 lines):

diff -r d367fe56323a -r d22c29f6a03d product.py
--- a/product.py        Thu Jul 09 10:21:06 2020 +0100
+++ b/product.py        Mon Jul 13 20:48:13 2020 +0200
@@ -188,7 +188,7 @@
                                 - (fifo_cost_price * current_out_qty))
                             / quantity)
                     else:
-                        cost_price = Decimal(0)
+                        cost_price = current_cost_price
                     current_cost_price = round_price(cost_price)
                 current_moves.clear()
                 current_out_qty = 0
@@ -241,8 +241,6 @@
                     ((cost_price * (quantity + current_out_qty))
                         - (fifo_cost_price * current_out_qty))
                     / quantity)
-            else:
-                cost_price = Decimal(0)
         for revision in revisions:
             cost_price = revision.get_cost_price(cost_price)
         return cost_price

Reply via email to