Allow to limit per-ticket fee to admission products

This commit is contained in:
Raphael Michel 2022-03-18 14:52:26 +01:00
parent 7c85925861
commit f31b03ac41
3 changed files with 10 additions and 0 deletions

View file

@ -7,6 +7,7 @@ from django.utils.translation import gettext_lazy as _, gettext, get_language
from pretix.base.decimal import round_decimal from pretix.base.decimal import round_decimal
from pretix.base.models import Event, Order, TaxRule from pretix.base.models import Event, Order, TaxRule
from pretix.base.models.orders import OrderFee from pretix.base.models.orders import OrderFee
from pretix.base.settings import settings_hierarkey
from pretix.base.signals import order_fee_calculation from pretix.base.signals import order_fee_calculation
from pretix.base.templatetags.money import money_filter from pretix.base.templatetags.money import money_filter
from pretix.control.signals import nav_event_settings from pretix.control.signals import nav_event_settings
@ -33,6 +34,10 @@ def get_fees(event, total, invoice_address, mod='', request=None, positions=[],
positions = get_cart(request) positions = get_cart(request)
positions = [pos for pos in positions if not pos.addon_to_id and pos.price != Decimal('0.00')] positions = [pos for pos in positions if not pos.addon_to_id and pos.price != Decimal('0.00')]
skip_non_admission = event.settings.get('service_fee_skip_non_admission', as_type=bool)
if skip_non_admission:
positions = [pos for pos in positions if pos.item.admission]
fee_per_ticket = event.settings.get('service_fee_per_ticket' + mod, as_type=Decimal) fee_per_ticket = event.settings.get('service_fee_per_ticket' + mod, as_type=Decimal)
if mod and fee_per_ticket is None: if mod and fee_per_ticket is None:
fee_per_ticket = event.settings.get('service_fee_per_ticket', as_type=Decimal) fee_per_ticket = event.settings.get('service_fee_per_ticket', as_type=Decimal)

View file

@ -9,6 +9,7 @@
<fieldset> <fieldset>
<legend>{% trans "Service fees" %}</legend> <legend>{% trans "Service fees" %}</legend>
{% bootstrap_field form.service_fee_per_ticket addon_after=request.event.currency layout="control" %} {% bootstrap_field form.service_fee_per_ticket addon_after=request.event.currency layout="control" %}
{% bootstrap_field form.service_fee_skip_non_admission layout="control" %}
{% bootstrap_field form.service_fee_abs addon_after=request.event.currency layout="control" %} {% bootstrap_field form.service_fee_abs addon_after=request.event.currency layout="control" %}
{% bootstrap_field form.service_fee_percent addon_after="%" layout="control" %} {% bootstrap_field form.service_fee_percent addon_after="%" layout="control" %}
{% bootstrap_field form.service_fee_skip_if_gift_card layout="control" %} {% bootstrap_field form.service_fee_skip_if_gift_card layout="control" %}

View file

@ -33,6 +33,10 @@ class ServiceFeeSettingsForm(SettingsForm):
'submitted, not if it\'s used to pay an unpaid order later.'), 'submitted, not if it\'s used to pay an unpaid order later.'),
required=False required=False
) )
service_fee_skip_non_admission = forms.BooleanField(
label=_('Do not charge per-ticket service fee on non-admission products'),
required=False
)
service_fee_abs_resellers = forms.DecimalField( service_fee_abs_resellers = forms.DecimalField(
label=_('Fixed fee per order'), label=_('Fixed fee per order'),