Fix special case if addon product is now set to require a voucher (vouchers for addons are not supported)

This commit is contained in:
Mira Weller
2026-07-07 18:36:54 +02:00
parent b65cdaa44a
commit 7e5d535fc4
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -2104,8 +2104,8 @@ class OrderChangeManager:
def _addon_is_available(a):
# If an item is no longer available due to time, it should usually also be no longer
# user-removable, because e.g. the stock has already been ordered.
# We always set has_voucher=True because if a product now requires a voucher, it usually does
# not mean it should be unremovable for others.
# We always set voucher=None because that's what's done when generating the form in
# OrderChangeMixin (vouchers for addons are not supported).
# This also prevents accidental removal through the UI because a hidden product will no longer
# be part of the input.
if not _allowed_on_order_sales_channel(a.item, self.order) or (
@@ -2117,7 +2117,7 @@ class OrderChangeManager:
self.order.event,
channel=self.order.sales_channel,
subevent=a.subevent,
has_voucher=True,
voucher=None,
base_qs=Item.objects.filter(pk=a.item.pk),
allow_addons=True
)
+2 -2
View File
@@ -57,7 +57,7 @@ def item_group_by_category(items):
def prepare_item_list_for_shop(event, *, channel: SalesChannel, subevent=None, voucher=None, require_seat=0, base_qs=None,
allow_addons=False, allow_cross_sell=False,
quota_cache=None, filter_items=None, filter_categories=None, memberships=None,
ignore_hide_sold_out_for_item_ids=None, has_voucher=False):
ignore_hide_sold_out_for_item_ids=None):
base_qs_set = base_qs is not None
base_qs = base_qs if base_qs is not None else event.items
@@ -74,7 +74,7 @@ def prepare_item_list_for_shop(event, *, channel: SalesChannel, subevent=None, v
Q(Q(available_from__isnull=True) | Q(available_from__lte=time_machine_now()) | Q(available_from_mode='info')) &
Q(Q(available_until__isnull=True) | Q(available_until__gte=time_machine_now()) | Q(available_until_mode='info'))
)
if not has_voucher and (not voucher or not voucher.show_hidden_items):
if not voucher or not voucher.show_hidden_items:
variation_q &= Q(hide_without_voucher=False)
if memberships is not None: