apply review comments

This commit is contained in:
imperosol
2026-06-11 18:13:03 +02:00
parent 998efc7c6b
commit caa2bf66be
8 changed files with 66 additions and 51 deletions
+1 -23
View File
@@ -66,29 +66,7 @@ if TYPE_CHECKING:
class BaseEbouticBasketForm(BaseBasketForm):
def _check_enough_money(self, *args, **kwargs):
# Disable money check
...
def _check_refills(self):
"""Check that this basket won't put customer balance above the limit."""
refill_type_id = settings.SITH_COUNTER_PRODUCTTYPE_REFILLING
total_refill = sum(
f.price.amount * f.cleaned_data["quantity"]
for f in self.forms
if f.price.product.product_type_id == refill_type_id
)
total_other = sum(
f.price.amount * f.cleaned_data["quantity"]
for f in self.forms
if f.price.product.product_type_id != refill_type_id
)
limit = settings.SITH_ACCOUNT_MAX_MONEY
if (total_refill - total_other + self.customer.amount) > limit:
raise ValidationError(
_("There cannot be more than %(money)d€ on an AE account")
% {"money": limit}
)
min_result_balance = None # user can pay by card, so no minimum enforced
EbouticBasketForm = forms.formset_factory(