diff --git a/comet/account/models.py b/comet/account/models.py index d042805..3ef2878 100644 --- a/comet/account/models.py +++ b/comet/account/models.py @@ -19,7 +19,7 @@ class Account(models.Model): """Adjust the ballance according to the sales, without saving the model.""" self.balance = Sale.objects.filter(account=self)\ - .aggregate(models.Sum('price'))['price__sum'] + .aggregate(models.Sum('price'))['price__sum'] or 0 class Sale(models.Model):