Convert VAT rate to decimal to be consistent

This commit is contained in:
PCoder 2019-11-15 12:24:24 +05:30
parent 76c2b9d16c
commit 582e952187

View file

@ -1,3 +1,4 @@
import decimal
import json
import logging
import os
@ -83,7 +84,7 @@ class GenericProduct(AssignPermissionsMixin, models.Model):
return self.product_name
def get_actual_price(self, vat_rate=None):
VAT = vat_rate if vat_rate is not None else self.product_vat
VAT = decimal.Decimal(vat_rate) if vat_rate is not None else self.product_vat
return round(
self.product_price + (self.product_price * VAT), 2
)