Warn about hidden product limitations

This commit is contained in:
Raphael Michel
2019-05-28 09:25:05 +02:00
parent 594803ec17
commit c6390520a7

View File

@@ -146,6 +146,14 @@ class VoucherForm(I18nModelForm):
data, self.instance.event,
self.instance.quota, self.instance.item, self.instance.variation
)
if self.instance.quota:
if all(i.hide_without_voucher for i in self.instance.quota.items.all()):
raise ValidationError({
'itemvar': [
_('The quota you selected only contains hidden products. Hidden products can currently only be '
'shown by using vouchers that directly apply to the product, not via a quota.')
]
})
Voucher.clean_subevent(
data, self.instance.event
)