Fixed issue with calculating the balance on an invoice

Improvements to the invoice importer
This commit is contained in:
Tom Price
2015-02-09 17:48:59 +00:00
parent 46aa363851
commit ff1d5730a2
2 changed files with 52 additions and 46 deletions

View File

@@ -329,10 +329,12 @@ class Invoice(models.Model):
@property
def payment_total(self):
total = self.payment_set.aggregate(models.Sum('amount'))
sum = self.payment_set.aggregate(models.Sum('amount'))['amount__sum']
# for payment in self.payment_set.all():
# total += payment.amount
return total
if sum:
return sum
return 0
@property
def balance(self):