changeset e87b85f7b869 in modules/sale_promotion:5.8
details: 
https://hg.tryton.org/modules/sale_promotion?cmd=changeset&node=e87b85f7b869
description:
        Do not apply negative unit price after promotion

        We must just set a unit price of 0.

        issue10903
        review377421002
        (grafted from 0f2befb01e316a15a38ccd4edfbc33671c35cee0)
diffstat:

 sale.py |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (12 lines):

diff -r 11758e1977a3 -r e87b85f7b869 sale.py
--- a/sale.py   Sat Oct 02 00:26:38 2021 +0200
+++ b/sale.py   Sat Oct 30 02:07:55 2021 +0200
@@ -247,6 +247,8 @@
                 continue
             context = self.get_context_formula(line)
             new_price = self.get_unit_price(**context)
+            if new_price < 0:
+                new_price = Decimal(0)
             if line.unit_price >= new_price:
                 line.unit_price = round_price(new_price)
                 line.promotion = self

Reply via email to