from django.db import models
+from django.db.models import Sum
from invoice import settings
from django.utils.translation import ugettext as _
date = models.DateField()
currency = models.CharField(max_length = 10)
+ def _total_sum(self):
+ return self.invoiceline_set.aggregate(total=Sum("amount"))["total"]
+
+ total_sum = property(_total_sum)
+
class VAT(models.Model):
""" Model representing different taxes to be used in Invoices"""
name = models.CharField(_('name'), max_length=255)