max amount for eboutic refills

This commit is contained in:
imperosol
2026-06-11 14:21:50 +02:00
parent 39bbbc8878
commit d41a3a524a
7 changed files with 97 additions and 40 deletions
+2 -2
View File
@@ -827,7 +827,7 @@ class Refilling(models.Model):
counter = models.ForeignKey(
Counter, related_name="refillings", blank=False, on_delete=models.CASCADE
)
amount = CurrencyField(_("amount"), min_value=0.01)
amount: CurrencyField = CurrencyField(_("amount"), min_value=0.01)
operator = models.ForeignKey(
User,
related_name="refillings_as_operator",
@@ -883,7 +883,7 @@ class Refilling(models.Model):
def clean(self):
super().clean()
if self.amount + self.customer.amount > settings.SITH_ACCOUNT_MAX_MONEY:
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}