Fix redemption of all-product vouchers with seating plans

This commit is contained in:
Raphael Michel
2019-12-11 12:06:03 +01:00
parent 24b931e1c3
commit 49b73fc096
3 changed files with 4 additions and 3 deletions

View File

@@ -460,7 +460,7 @@ class Voucher(LoggedModel):
return Order.objects.filter(all_positions__voucher__in=[self]).distinct()
def seating_available(self):
def seating_available(self, subevent):
kwargs = {}
if self.subevent:
kwargs['subevent'] = self.subevent
@@ -469,4 +469,4 @@ class Voucher(LoggedModel):
elif self.item_id:
return self.item.seat_category_mappings.filter(**kwargs).exists()
else:
return False
return bool(subevent.seating_plan) if subevent else self.event.seating_plan

View File

@@ -30,7 +30,7 @@
<input type="hidden" name="subevent" value="{{ subevent.id|default_if_none:"" }}" />
<input type="hidden" name="_voucher_code" value="{{ voucher.code }}">
{% if voucher.seating_available %}
{% if seating_available %}
{% if event.has_subevents %}
{% eventsignal event "pretix.presale.signals.render_seating_plan" request=request subevent=subevent voucher=voucher %}
{% else %}

View File

@@ -435,6 +435,7 @@ class RedeemView(NoSearchIndexViewMixin, EventViewMixin, TemplateView):
context['items_by_category'] = item_group_by_category(items)
context['subevent'] = self.subevent
context['seating_available'] = self.voucher.seating_available(self.subevent)
context['new_tab'] = (
'require_cookie' in self.request.GET and