mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Show message and cart after tax rate has changed
This commit is contained in:
@@ -1063,6 +1063,7 @@ def update_tax_rates(event: Event, cart_id: str, invoice_address: InvoiceAddress
|
||||
if pos.tax_rate != rate:
|
||||
current_net = pos.price - pos.tax_value
|
||||
new_gross = pos.item.tax(current_net, base_price_is='net', invoice_address=invoice_address).gross
|
||||
totaldiff += new_gross - pos.price
|
||||
pos.price = new_gross
|
||||
pos.includes_tax = rate != Decimal('0.00')
|
||||
pos.override_tax_rate = rate
|
||||
|
||||
@@ -554,11 +554,16 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
|
||||
addr = self.invoice_form.save()
|
||||
self.cart_session['invoice_address'] = addr.pk
|
||||
|
||||
update_tax_rates(
|
||||
diff = update_tax_rates(
|
||||
event=request.event,
|
||||
cart_id=get_or_create_cart_id(request),
|
||||
invoice_address=self.invoice_form.instance
|
||||
)
|
||||
if abs(diff) > Decimal('0.001'):
|
||||
messages.info(request, _('Due to thec invoice address you entered, we need to apply a different tax '
|
||||
'rate to your purchase and the price of the products in your cart has '
|
||||
'changed accordingly.'))
|
||||
return redirect(self.get_next_url(request) + '?open_cart=true')
|
||||
|
||||
return redirect(self.get_next_url(request))
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{% load bootstrap3 %}
|
||||
{% block title %}{% trans "Checkout" %}{% endblock %}
|
||||
{% block content %}
|
||||
<details class="panel panel-default cart">
|
||||
<details class="panel panel-default cart" {% if "open_cart" in request.GET %}open{% endif %}>
|
||||
<summary class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
<span>
|
||||
|
||||
Reference in New Issue
Block a user