mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 03:49:24 +00:00
Add the merge user function
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user