From 6aa1109eeac8410481e24ff99a63f8735cb0463a Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 4 Jun 2012 17:47:27 +0100 Subject: [PATCH] Fix error if a corp has 0% tax rate. --- pacmanager/core/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pacmanager/core/models.py b/pacmanager/core/models.py index 818a1f7..5952299 100644 --- a/pacmanager/core/models.py +++ b/pacmanager/core/models.py @@ -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