Fix error if a corp has 0% tax rate.

This commit is contained in:
2012-06-04 17:47:27 +01:00
parent 1295cdc7d4
commit 6aa1109eea

View File

@@ -66,7 +66,10 @@ class MonthTotal(models.Model):
if self.corporation.fixed_value is not None:
return self.corporation.fixed_value
threshold = Decimal(managerconf.get('pac.tax_threshold', '200000000'))
calc = (self.tax / self.corporation.tax_rate) * int(managerconf.get('pac.tax_rate', '10'))
if self.corporation.tax_rate == 0:
calc = 0
else:
calc = (self.tax / self.corporation.tax_rate) * int(managerconf.get('pac.tax_rate', '10'))
if calc > threshold: return round(calc, 2)
return threshold