Fix negative prices in bundles when tax rate is 0 (#4513)

This commit is contained in:
Raphael Michel
2024-10-09 08:16:01 +02:00
committed by GitHub
parent 61b25acdd2
commit 8efe276ed0
2 changed files with 30 additions and 2 deletions

View File

@@ -306,8 +306,11 @@ class TaxRule(LoggedModel):
if rate == Decimal('0.00'):
return TaxedPrice(
net=base_price - subtract_from_gross, gross=base_price - subtract_from_gross, tax=Decimal('0.00'),
rate=rate, name=self.name
net=max(Decimal('0.00'), base_price - subtract_from_gross),
gross=max(Decimal('0.00'), base_price - subtract_from_gross),
tax=Decimal('0.00'),
rate=rate,
name=self.name,
)
if base_price_is == 'auto':