Improve add-on products

This commit is contained in:
Raphael Michel
2017-03-19 14:33:45 +01:00
parent 5bcfb958f0
commit b52f2f5a9e
36 changed files with 802 additions and 131 deletions

View File

@@ -257,7 +257,8 @@ class EventSettingsForm(SettingsForm):
)
max_items_per_order = forms.IntegerField(
min_value=1,
label=_("Maximum number of items per order")
label=_("Maximum number of items per order"),
help_text=_("Add-on products will not be counted.")
)
reservation_time = forms.IntegerField(
min_value=0,
@@ -607,6 +608,10 @@ class TicketSettingsForm(SettingsForm):
required=True,
widget=forms.DateTimeInput(attrs={'class': 'datetimepicker'})
)
ticket_download_addons = forms.BooleanField(
label=_("Offer to download tickets separately for add-on products"),
required=False
)
def prepare_fields(self):
# See clean()

View File

@@ -265,3 +265,7 @@ class ItemAddOnForm(I18nModelForm):
'min_count',
'max_count',
]
help_texts = {
'min_count': _('Be aware that setting a minimal number makes it impossible to buy this product if all '
'available add-ons are sold out.')
}

View File

@@ -76,6 +76,9 @@ class VoucherForm(I18nModelForm):
else:
self.instance.variation = None
self.instance.quota = None
if self.instance.item.category and self.instance.item.category.is_addon:
raise ValidationError(_('It is currently not possible to create vouchers for add-on products.'))
else:
self.instance.quota = Quota.objects.get(pk=quotaid, event=self.instance.event)
self.instance.item = None