From 45ae9317d8d24937b6e53db933bf9b0af356cf7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 30 Oct 2021 02:07:55 +0200 Subject: [PATCH] Do not apply negative unit price after promotion We must just set a unit price of 0. issue10903 review377421002 (grafted from 0f2befb01e316a15a38ccd4edfbc33671c35cee0) --HG-- branch : 6.0 --- sale.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sale.py b/sale.py index e1a37cbcd4..f341f6256a 100644 --- a/sale.py +++ b/sale.py @@ -298,6 +298,8 @@ class Promotion( 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