Make product.tax_rule required as soon as tax rules exist to avoid users from screwing up their taxes

This commit is contained in:
Raphael Michel
2019-05-28 08:56:02 +02:00
parent 32ce3a4319
commit 594803ec17

View File

@@ -206,6 +206,8 @@ class ItemCreateForm(I18nModelForm):
empty_label=_('Do not copy'),
required=False
)
if self.event.tax_rules.exists():
self.fields['tax_rule'].required = True
if not self.event.has_subevents:
choices = [
@@ -364,6 +366,8 @@ class ItemUpdateForm(I18nModelForm):
'over 65. This ticket includes access to all parts of the event, except the VIP '
'area.'
)
if self.event.tax_rules.exists():
self.fields['tax_rule'].required = True
self.fields['description'].widget.attrs['rows'] = '4'
self.fields['sales_channels'] = forms.MultipleChoiceField(
label=_('Sales channels'),