Make all settings fields optional

This commit is contained in:
Raphael Michel 2019-05-29 09:27:24 +02:00
parent 315d6de155
commit cb1b5a07c7
2 changed files with 18 additions and 5 deletions

View file

@ -14,6 +14,9 @@
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>{% trans "Service fees with resellers" %}</legend> <legend>{% trans "Service fees with resellers" %}</legend>
<p>
{% trans "If you keep values empty, we will fall back to the values from above. If you do not want to charge any fees through this sales channel, set them to zero explicity." %}
</p>
{% bootstrap_field form.service_fee_per_ticket_resellers addon_after=request.event.currency layout="control" %} {% bootstrap_field form.service_fee_per_ticket_resellers addon_after=request.event.currency layout="control" %}
{% bootstrap_field form.service_fee_abs_resellers addon_after=request.event.currency layout="control" %} {% bootstrap_field form.service_fee_abs_resellers addon_after=request.event.currency layout="control" %}
{% bootstrap_field form.service_fee_percent_resellers addon_after="%" layout="control" %} {% bootstrap_field form.service_fee_percent_resellers addon_after="%" layout="control" %}

View file

@ -9,27 +9,37 @@ from pretix.helpers.money import change_decimal_field
class ServiceFeeSettingsForm(SettingsForm): class ServiceFeeSettingsForm(SettingsForm):
service_fee_abs = forms.DecimalField(label=_('Fixed fee per order')) service_fee_abs = forms.DecimalField(
label=_('Fixed fee per order'),
required=False
)
service_fee_percent = forms.DecimalField( service_fee_percent = forms.DecimalField(
label=_('Percentual fee per order'), label=_('Percentual fee per order'),
help_text=_('Percentage of the order total. Note that this percentage will currently only ' help_text=_('Percentage of the order total. Note that this percentage will currently only '
'be calculated on the summed price of sold tickets, not on other fees like e.' 'be calculated on the summed price of sold tickets, not on other fees like e.'
'g. shipping fees, if there are any.') 'g. shipping fees, if there are any.'),
required=False
) )
service_fee_per_ticket = forms.DecimalField( service_fee_per_ticket = forms.DecimalField(
label=_('Fixed fee per ticket'), label=_('Fixed fee per ticket'),
help_text=_('This fee will be added for each ticket sold, except for free items and addons.') help_text=_('This fee will be added for each ticket sold, except for free items and addons.'),
required=False
) )
service_fee_abs_resellers = forms.DecimalField(label=_('Fixed fee per order')) service_fee_abs_resellers = forms.DecimalField(
label=_('Fixed fee per order'),
required=False
)
service_fee_percent_resellers = forms.DecimalField( service_fee_percent_resellers = forms.DecimalField(
label=_('Percentual fee per order'), label=_('Percentual fee per order'),
help_text=_('Percentage of the order total. Note that this percentage will currently only ' help_text=_('Percentage of the order total. Note that this percentage will currently only '
'be calculated on the summed price of sold tickets, not on other fees like e.' 'be calculated on the summed price of sold tickets, not on other fees like e.'
'g. shipping fees, if there are any.') 'g. shipping fees, if there are any.'),
required=False
) )
service_fee_per_ticket_resellers = forms.DecimalField( service_fee_per_ticket_resellers = forms.DecimalField(
label=_('Fixed fee per ticket'), label=_('Fixed fee per ticket'),
required=False,
help_text=_('This fee will be added for each ticket sold, except for free items and addons.') help_text=_('This fee will be added for each ticket sold, except for free items and addons.')
) )