Self-service order change: Enforce hidden variations

This commit is contained in:
Raphael Michel
2023-02-22 16:38:34 +01:00
parent 8a5463320a
commit 79c7b53efa
2 changed files with 98 additions and 1 deletions

View File

@@ -72,12 +72,17 @@ class OrderPositionChangeForm(forms.Form):
quota_cache.update(qa.results)
for v in variations:
label = f'{i.name} {v.value}'
if instance.variation_id == v.id:
choices.append((f'{i.pk}-{v.pk}', label))
continue
if instance.voucher and not instance.voucher.applies_to(i, v):
continue
if v.hide_without_voucher and not (instance.voucher and instance.voucher.show_hidden_items):
continue
if not v.active:
continue