mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 11:59:23 +00:00
Allow transactions on counter when an user has recorded too many products as long as he doesn't record more
This commit is contained in:
@ -126,6 +126,11 @@ class BaseBasketForm(BaseFormSet):
|
||||
if form.product.is_unrecord_product:
|
||||
self.total_recordings += form.cleaned_data["quantity"]
|
||||
|
||||
# We don't want to block an user that have negative recordings
|
||||
# if he isn't recording anything or reducing it's recording count
|
||||
if self.total_recordings <= 0:
|
||||
return
|
||||
|
||||
if not customer.can_record_more(self.total_recordings):
|
||||
raise ValidationError(_("This user have reached his recording limit"))
|
||||
|
||||
|
Reference in New Issue
Block a user