Tax rounding: Allow to apply only for B2B (Z#23220106) (#5810)

* Tax rounding: Allow to apply only for B2B (Z#23220106)

Most effective in combination with #5807

* Update src/pretix/base/settings.py

Co-authored-by: Richard Schreiber <schreiber@pretix.eu>

---------

Co-authored-by: Richard Schreiber <schreiber@pretix.eu>
This commit is contained in:
Raphael Michel
2026-01-30 11:53:38 +01:00
committed by GitHub
parent 8c4e0bdb82
commit d58a6e2503
10 changed files with 100 additions and 26 deletions

View File

@@ -493,7 +493,18 @@
</div>
{% endif %}
</div>
{% if cart.show_rounding_info %}
<div class="text-muted">
<small>
{% icon "info-circle" %}
{% blocktrans trimmed %}
Since you entered a business address, your price was computed from the
VAT-exclusive price. Due to rounding, this caused a small change to the
total price.
{% endblocktrans %}
</small>
</div>
{% endif %}
<div class="row">
<div class="col-md-12">
{% if not cart.is_ordered %}

View File

@@ -167,7 +167,7 @@ class CartMixin:
fees = []
if not order:
apply_rounding(self.request.event.settings.tax_rounding, self.request.event.currency, [*lcp, *fees])
apply_rounding(self.request.event.settings.tax_rounding, self.invoice_address, self.request.event.currency, [*lcp, *fees])
total = sum([c.price for c in lcp]) + sum([f.value for f in fees])
net_total = sum(p.price - p.tax_value for p in lcp) + sum([f.net_value for f in fees])
@@ -264,6 +264,11 @@ class CartMixin:
'max_expiry_extend': max_expiry_extend,
'is_ordered': bool(order),
'itemcount': sum(c.count for c in positions if not c.addon_to),
'show_rounding_info': (
self.request.event.settings.tax_rounding == "sum_by_net_only_business" and
not self.request.event.settings.display_net_prices and
sum(c.price_includes_rounding_correction for c in positions) + sum(f.price_includes_rounding_correction for f in fees)
),
'itemvarsums': itemvarsums,
'current_selected_payments': [
p for p in self.current_selected_payments(lcp, fees, self.invoice_address)
@@ -275,7 +280,7 @@ class CartMixin:
raw_payments = copy.deepcopy(self.cart_session.get('payments', []))
fees = [f for f in fees if f.fee_type != OrderFee.FEE_TYPE_PAYMENT] # we re-compute these here
apply_rounding(self.request.event.settings.tax_rounding, self.request.event.currency, [*positions, *fees])
apply_rounding(self.request.event.settings.tax_rounding, invoice_address, self.request.event.currency, [*positions, *fees])
total = sum([c.price for c in positions]) + sum([f.value for f in fees])
payments = []
@@ -329,7 +334,7 @@ class CartMixin:
fees.append(pf)
# Re-apply rounding as grand total has changed
apply_rounding(self.request.event.settings.tax_rounding, self.request.event.currency, [*positions, *fees])
apply_rounding(self.request.event.settings.tax_rounding, invoice_address, self.request.event.currency, [*positions, *fees])
total = sum([c.price for c in positions]) + sum([f.value for f in fees])
# Re-calculate to_pay as grand total has changed