Hide quota options when creating a product with variations

This commit is contained in:
Raphael Michel
2017-08-01 21:05:38 +02:00
parent 9abdc6a3cc
commit f70eb95346
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -195,7 +195,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)
@@ -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();
});