From bee6a65ede8ff5c8165076585678980142005210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Mon, 16 May 2016 16:14:16 +0200 Subject: [PATCH] Prices are with VAT, turning the calculation around. --- shop/models.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shop/models.py b/shop/models.py index 05b2785f..b07b83c0 100644 --- a/shop/models.py +++ b/shop/models.py @@ -72,6 +72,14 @@ class Order(CreatedUpdatedModel): @property def subtotal(self): + return self.total - self.vat + + @property + def vat(self): + return (self.total/100)*25 + + @property + def total(self): return self.products.aggregate( sum=Sum( models.F('orderproductrelation__product__price') * @@ -80,14 +88,6 @@ class Order(CreatedUpdatedModel): ) )['sum'] - @property - def vat(self): - return (self.subtotal/100)*25 - - @property - def total(self): - return self.subtotal + self.vat - class ProductCategory(CreatedUpdatedModel, UUIDModel): class Meta: