Do not format discount with currency if there is no currency

Closes #13531
(grafted from b35f96c592acdb738b2e2328dd274178514c0b90)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier
2024-09-28 16:37:51 +02:00
parent 59f18d44cd
commit 81b4acb22d
+6 -2
View File
@@ -136,8 +136,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(
'%.f', (price_digits[1], amount), monetary=True)
else:
return lang.format('%i', rate * 100) + '%'