Prices are with VAT, turning the calculation around.
This commit is contained in:
parent
9eefc6bdfd
commit
bee6a65ede
|
@ -72,6 +72,14 @@ class Order(CreatedUpdatedModel):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def subtotal(self):
|
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(
|
return self.products.aggregate(
|
||||||
sum=Sum(
|
sum=Sum(
|
||||||
models.F('orderproductrelation__product__price') *
|
models.F('orderproductrelation__product__price') *
|
||||||
|
@ -80,14 +88,6 @@ class Order(CreatedUpdatedModel):
|
||||||
)
|
)
|
||||||
)['sum']
|
)['sum']
|
||||||
|
|
||||||
@property
|
|
||||||
def vat(self):
|
|
||||||
return (self.subtotal/100)*25
|
|
||||||
|
|
||||||
@property
|
|
||||||
def total(self):
|
|
||||||
return self.subtotal + self.vat
|
|
||||||
|
|
||||||
|
|
||||||
class ProductCategory(CreatedUpdatedModel, UUIDModel):
|
class ProductCategory(CreatedUpdatedModel, UUIDModel):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
Loading…
Reference in a new issue