Allow fractional units

This commit is contained in:
Yingtong Li 2020-11-17 19:06:19 +11:00
parent 057a97b33a
commit 44ba18d22e
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
1 changed files with 2 additions and 2 deletions

View File

@ -100,7 +100,7 @@ class BudgetRevision(models.Model):
def get_revenue_total(self):
total = Decimal(0)
for item in self.revenue:
total += Decimal(item['Unit price']) * item['Units']
total += Decimal(item['Unit price']) * Decimal(item['Units'])
if item['IWT'] and item['Unit price'] > 0:
total -= (Decimal(item['Unit price']) - (Decimal(item['Unit price']) - Decimal('0.8133')) / Decimal('1.01884')) * item['Units']
return total
@ -108,7 +108,7 @@ class BudgetRevision(models.Model):
def get_expense_total(self):
total = Decimal(0)
for item in self.expense:
total += Decimal(item['Unit price']) * item['Units']
total += Decimal(item['Unit price']) * Decimal(item['Units'])
if not self.expense_no_emergency_fund:
total *= Decimal('1.05')
return total