mirror of
https://github.com/ae-utbm/sith.git
synced 2026-10-30 22:29:32 +00:00
max amount for counter refills
This commit is contained in:
1 parent
f6f31af975
commit
5e553d91a8
6 files changed
+60
-33
No files matched your search
@@ -881,6 +881,14 @@ class Refilling(models.Model):
|
||||
return False
|
||||
return user.is_owner(self.counter) and self.payment_method != "CARD"
|
||||
|
||||
def clean(self):
|
||||
super().clean()
|
||||
if self.amount + self.customer.amount > settings.SITH_ACCOUNT_MAX_MONEY:
|
||||
raise ValidationError(
|
||||
_("There cannot be more than %(money)d€ on an AE account")
|
||||
% {"money": settings.SITH_ACCOUNT_MAX_MONEY}
|
||||
)
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
self.customer.amount -= self.amount
|
||||
self.customer.save()
|
||||
|
||||
Reference in new issue
Block a user