mirror of
https://github.com/pretix/pretix-servicefees.git
synced 2024-11-23 22:50:21 +01:00
Allow to charge fees on addons
This commit is contained in:
parent
f31b03ac41
commit
2c5b7acd5b
3 changed files with 13 additions and 1 deletions
|
@ -32,7 +32,11 @@ def navbar_settings(sender, request, **kwargs):
|
||||||
def get_fees(event, total, invoice_address, mod='', request=None, positions=[], gift_cards=None):
|
def get_fees(event, total, invoice_address, mod='', request=None, positions=[], gift_cards=None):
|
||||||
if request is not None and not positions:
|
if request is not None and not 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 pos.price != Decimal('0.00')]
|
||||||
|
|
||||||
|
skip_addons = event.settings.get('service_fee_skip_addons', as_type=bool)
|
||||||
|
if skip_addons:
|
||||||
|
positions = [pos for pos in positions if not pos.addon_to_id]
|
||||||
|
|
||||||
skip_non_admission = event.settings.get('service_fee_skip_non_admission', as_type=bool)
|
skip_non_admission = event.settings.get('service_fee_skip_non_admission', as_type=bool)
|
||||||
if skip_non_admission:
|
if skip_non_admission:
|
||||||
|
@ -156,3 +160,6 @@ def order_meta_signal(sender: Event, request: HttpRequest, **kwargs):
|
||||||
except ResellerException:
|
except ResellerException:
|
||||||
pass
|
pass
|
||||||
return meta
|
return meta
|
||||||
|
|
||||||
|
|
||||||
|
settings_hierarkey.add_default('service_fee_skip_addons', 'True', bool)
|
|
@ -10,6 +10,7 @@
|
||||||
<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_skip_non_admission layout="control" %}
|
||||||
|
{% bootstrap_field form.service_fee_skip_addons 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" %}
|
||||||
|
|
|
@ -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_addons = forms.BooleanField(
|
||||||
|
label=_('Do not charge per-ticket service fee on add-on products'),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
service_fee_skip_non_admission = forms.BooleanField(
|
service_fee_skip_non_admission = forms.BooleanField(
|
||||||
label=_('Do not charge per-ticket service fee on non-admission products'),
|
label=_('Do not charge per-ticket service fee on non-admission products'),
|
||||||
required=False
|
required=False
|
||||||
|
|
Loading…
Reference in a new issue