From d9076a4f5f5bbe280821facccf953b226227c149 Mon Sep 17 00:00:00 2001 From: Tom Price Date: Wed, 19 Apr 2017 15:27:12 +0100 Subject: [PATCH] Quantize event totals to prevent issues with mixed precision on client authorisation form. --- RIGS/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RIGS/models.py b/RIGS/models.py index 31496ed0..4a5f6988 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -366,7 +366,7 @@ class Event(models.Model, RevisionMixin): @property def vat(self): - return self.sum_total * self.vat_rate.rate + return Decimal(self.sum_total * self.vat_rate.rate).quantize(Decimal('.01')) """ Inc VAT @@ -374,7 +374,7 @@ class Event(models.Model, RevisionMixin): @property def total(self): - return self.sum_total + self.vat + return Decimal(self.sum_total + self.vat).quantize(Decimal('.01')) @property def cancelled(self):