Hide quota options when creating a product with variations

This commit is contained in:
Raphael Michel
2017-07-31 13:52:50 +02:00
parent b1b49758b1
commit 86f17094bb
2 changed files with 8 additions and 1 deletions

View File

@@ -196,7 +196,7 @@ class ItemCreateForm(I18nModelForm):
instance = super().save(*args, **kwargs)
if not self.event.has_subevents:
if not self.event.has_subevents and not self.cleaned_data.get('has_variations'):
if self.cleaned_data.get('quota_option') == self.EXISTING and self.cleaned_data.get('quota_add_existing') is not None:
quota = self.cleaned_data.get('quota_add_existing')
quota.items.add(self.instance)

View File

@@ -26,4 +26,11 @@ $(document).ready(function () {
hideDeselected(true);
}
);
function toggleblock() {
$("#new-quota-group").closest('fieldset').toggle(!$("#id_has_variations").prop('checked'));
}
$("#id_has_variations").change(toggleblock);
toggleblock();
});