Do not format discount with currency if there is no currency

Closes #13531
(grafted from b35f96c592acdb738b2e2328dd274178514c0b90)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier committed 2024-09-19 19:30:06 +02:00
1 parent e18d53e99c
commit 2a173876bb
1 file changed
+6 -2
+6 -2
View File
@@ -133,8 +133,12 @@ class Line(metaclass=PoolMeta):
if not rate or rate % Decimal('0.01'):
amount = self.on_change_with_discount_amount()
if amount:
return lang.currency(
amount, self.sale.currency, digits=price_digits[1])
if self.sale and self.sale.currency:
return lang.currency(
amount, self.sale.currency, digits=price_digits[1])
else:
return lang.format_number(
amount, digits=price_digits[1], monetary=True)
else:
return lang.format('%i', rate * 100) + '%'