Order change form: Allow to add multiple identical positions (Z#23227479) (#6044)

* Order change form: Allow to add multiple identical positions (Z#23227479)

* New implementation
This commit is contained in:
Raphael Michel
2026-04-01 11:54:48 +02:00
committed by GitHub
parent 8c251029b9
commit ed1459b1dd
6 changed files with 95 additions and 55 deletions

View File

@@ -331,6 +331,10 @@ class OtherOperationsForm(forms.Form):
class OrderPositionAddForm(forms.Form):
count = forms.IntegerField(
label=_('Number of products to add'),
initial=1,
)
itemvar = forms.ChoiceField(
label=_('Product')
)
@@ -432,6 +436,10 @@ class OrderPositionAddForm(forms.Form):
d['used_membership'] = [m for m in self.memberships if str(m.pk) == d['used_membership']][0]
else:
d['used_membership'] = None
if d.get("count", 1) and d.get("seat"):
raise ValidationError({
"seat": _("You can not choose a seat when adding multiple products at once.")
})
return d