Mise à 0 du solde quand pas de vente
This commit is contained in:
parent
ef664804de
commit
e11ad583cb
1 changed files with 1 additions and 1 deletions
|
@ -19,7 +19,7 @@ class Account(models.Model):
|
||||||
"""Adjust the ballance according to the sales,
|
"""Adjust the ballance according to the sales,
|
||||||
without saving the model."""
|
without saving the model."""
|
||||||
self.balance = Sale.objects.filter(account=self)\
|
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):
|
class Sale(models.Model):
|
||||||
|
|
Loading…
Reference in a new issue