From 08bfe13dc352e5e6747d60be66bde2687f0e2a2a Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 8 Jul 2019 11:14:38 +0200 Subject: [PATCH] Re-add validation for hidden vouchers --- src/pretix/control/forms/vouchers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pretix/control/forms/vouchers.py b/src/pretix/control/forms/vouchers.py index c06f905883..c551e2b367 100644 --- a/src/pretix/control/forms/vouchers.py +++ b/src/pretix/control/forms/vouchers.py @@ -148,6 +148,16 @@ class VoucherForm(I18nModelForm): data, self.instance.event, self.instance.quota, self.instance.item, self.instance.variation ) + if not self.instance.show_hidden_items and ( + (self.instance.quota and all(i.hide_without_voucher for i in self.instance.quota.items.all())) + or (self.instance.item and self.instance.item.hide_without_voucher) + ): + raise ValidationError({ + 'show_hidden_items': [ + _('The voucher only matches hidden products but you have not selected that it should show ' + 'them.') + ] + }) Voucher.clean_subevent( data, self.instance.event )