Add the merge user function

This commit is contained in:
Skia
2016-09-21 14:09:16 +02:00
parent f1e54439e1
commit 9e4e9597d1
15 changed files with 249 additions and 99 deletions

View File

@ -44,6 +44,14 @@ class Customer(models.Model):
raise ValidationError(_("Not enough money"))
super(Customer, self).save(*args, **kwargs)
def recompute_amount(self):
self.amount = 0
for r in self.refillings.all():
self.amount += r.amount
for s in self.buyings.filter(payment_method="SITH_ACCOUNT"):
self.amount -= s.quantity * s.unit_price
self.save()
class ProductType(models.Model):
"""
This describes a product type