From c63bc46d3b6375375a2c29dd5fff05856cccf117 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 15 Feb 2023 18:06:04 +0100 Subject: [PATCH] Add validation for voucher products not being addon products --- src/pretix/base/models/vouchers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pretix/base/models/vouchers.py b/src/pretix/base/models/vouchers.py index 1a18ca09c7..b22a3f76b7 100644 --- a/src/pretix/base/models/vouchers.py +++ b/src/pretix/base/models/vouchers.py @@ -331,8 +331,12 @@ class Voucher(LoggedModel): if item: raise ValidationError(_('You cannot select a quota and a specific product at the same time.')) elif item: + if item.require_bundling or item.category.is_addon: + raise ValidationError(_('You cannot select a product that is only available as an add-on product or ' + 'as part of a bundle, since vouchers cannot be applied to add-on products or ' + 'bundled products.')) if item.event != event: - raise ValidationError(_('You cannot select an item that belongs to a different event.')) + raise ValidationError(_('You cannot select a product that belongs to a different event.')) if variation and (not item or not item.has_variations): raise ValidationError(_('You cannot select a variation without having selected a product that provides ' 'variations.'))