changeset f0d0ff90fff6 in modules/sale_promotion:default
details:
https://hg.tryton.org/modules/sale_promotion?cmd=changeset&node=f0d0ff90fff6
description:
Support empty list price on product
issue10244
review350341002
diffstat:
sale.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diffs (29 lines):
diff -r b78badef91e8 -r f0d0ff90fff6 sale.py
--- a/sale.py Mon Aug 30 00:27:13 2021 +0200
+++ b/sale.py Mon Sep 13 23:29:57 2021 +0200
@@ -15,6 +15,7 @@
from trytond.modules.currency.fields import Monetary
from trytond.modules.product import price_digits, round_price
+from trytond.modules.product_price_list import Null
from .exceptions import FormulaError
@@ -278,7 +279,7 @@
continue
context = self.get_context_formula(line)
new_price = self.get_unit_price(**context)
- if line.unit_price >= new_price:
+ if new_price is not None and line.unit_price >= new_price:
line.unit_price = round_price(new_price)
line.promotion = self
applied = True
@@ -297,7 +298,7 @@
unit_price = Decimal(0)
return {
'names': {
- 'unit_price': unit_price,
+ 'unit_price': unit_price if unit_price is not None else Null(),
},
}