mirror of
https://github.com/ae-utbm/sith.git
synced 2026-10-18 16:38:59 +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:
1 parent
a96b374ad7
commit
1978658b9c
4 files changed
+171
-135
No files matched your search
@@ -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