Fix voucher item validation

This commit is contained in:
Raphael Michel
2023-02-16 14:45:18 +01:00
parent 75f1ee9191
commit 076f279a60

View File

@@ -331,7 +331,7 @@ 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:
if item.require_bundling or (item.category_id and 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.'))