mirror of
https://github.com/pretix/pretix.git
synced 2025-12-10 01:12:28 +00:00
Tax calculation of "original prices"
This commit is contained in:
@@ -271,10 +271,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-xs-6 price">
|
<div class="col-md-2 col-xs-6 price">
|
||||||
{% if var.original_price %}
|
{% if var.original_price %}
|
||||||
<del>{{ var.original_price|money:event.currency }}</del>
|
{% if event.settings.display_net_prices %}
|
||||||
<ins>
|
<del>{{ var.original_price.net|money:event.currency }}</del>
|
||||||
{% elif item.original_price %}
|
{% else %}
|
||||||
<del>{{ item.original_price|money:event.currency }}</del>
|
<del>{{ var.original_price.gross|money:event.currency }}</del>
|
||||||
|
{% endif %}
|
||||||
<ins>
|
<ins>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if item.free_price %}
|
{% if item.free_price %}
|
||||||
@@ -386,7 +387,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-xs-6 price">
|
<div class="col-md-2 col-xs-6 price">
|
||||||
{% if item.original_price %}
|
{% if item.original_price %}
|
||||||
<del>{{ item.original_price|money:event.currency }}</del>
|
{% if event.settings.display_net_prices %}
|
||||||
|
<del>{{ item.original_price.net|money:event.currency }}</del>
|
||||||
|
{% else %}
|
||||||
|
<del>{{ item.original_price.gross|money:event.currency }}</del>
|
||||||
|
{% endif %}
|
||||||
<ins>
|
<ins>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if item.free_price %}
|
{% if item.free_price %}
|
||||||
|
|||||||
@@ -94,10 +94,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-xs-6 price">
|
<div class="col-md-2 col-xs-6 price">
|
||||||
{% if var.original_price %}
|
{% if var.original_price %}
|
||||||
<del>{{ var.original_price|money:event.currency }}</del>
|
{% if event.settings.display_net_prices %}
|
||||||
<ins>
|
<del>{{ var.original_price.net|money:event.currency }}</del>
|
||||||
{% elif item.original_price %}
|
{% else %}
|
||||||
<del>{{ item.original_price|money:event.currency }}</del>
|
<del>{{ var.original_price.gross|money:event.currency }}</del>
|
||||||
|
{% endif %}
|
||||||
<ins>
|
<ins>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if item.free_price %}
|
{% if item.free_price %}
|
||||||
@@ -200,7 +201,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-xs-6 price">
|
<div class="col-md-2 col-xs-6 price">
|
||||||
{% if item.original_price %}
|
{% if item.original_price %}
|
||||||
<del>{{ item.original_price|money:event.currency }}</del>
|
{% if event.settings.display_net_prices %}
|
||||||
|
<del>{{ item.original_price.net|money:event.currency }}</del>
|
||||||
|
{% else %}
|
||||||
|
<del>{{ item.original_price.gross|money:event.currency }}</del>
|
||||||
|
{% endif %}
|
||||||
<ins>
|
<ins>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if item.free_price %}
|
{% if item.free_price %}
|
||||||
|
|||||||
@@ -136,7 +136,13 @@ def get_grouped_items(event, subevent=None, voucher=None, channel='web'):
|
|||||||
item.display_price = item.tax(price, currency=event.currency, include_bundled=True)
|
item.display_price = item.tax(price, currency=event.currency, include_bundled=True)
|
||||||
|
|
||||||
if price != original_price:
|
if price != original_price:
|
||||||
item.original_price = original_price
|
item.original_price = item.tax(original_price, currency=event.currency, include_bundled=True)
|
||||||
|
else:
|
||||||
|
item.original_price = (
|
||||||
|
item.tax(item.original_price, currency=event.currency, include_bundled=True,
|
||||||
|
base_price_is='net' if event.settings.display_net_prices else 'gross') # backwards-compat
|
||||||
|
if item.original_price else None
|
||||||
|
)
|
||||||
|
|
||||||
display_add_to_cart = display_add_to_cart or item.order_max > 0
|
display_add_to_cart = display_add_to_cart or item.order_max > 0
|
||||||
else:
|
else:
|
||||||
@@ -165,7 +171,13 @@ def get_grouped_items(event, subevent=None, voucher=None, channel='web'):
|
|||||||
var.display_price = var.tax(price, currency=event.currency, include_bundled=True)
|
var.display_price = var.tax(price, currency=event.currency, include_bundled=True)
|
||||||
|
|
||||||
if price != original_price:
|
if price != original_price:
|
||||||
var.original_price = original_price
|
var.original_price = var.tax(original_price, currency=event.currency, include_bundled=True)
|
||||||
|
else:
|
||||||
|
var.original_price = (
|
||||||
|
var.tax(var.original_price or item.original_price, currency=event.currency,
|
||||||
|
include_bundled=True,
|
||||||
|
base_price_is='net' if event.settings.display_net_prices else 'gross') # backwards-compat
|
||||||
|
) if var.original_price or item.original_price else None
|
||||||
|
|
||||||
display_add_to_cart = display_add_to_cart or var.order_max > 0
|
display_add_to_cart = display_add_to_cart or var.order_max > 0
|
||||||
|
|
||||||
|
|||||||
@@ -200,7 +200,12 @@ class WidgetAPIProductList(EventListMixin, View):
|
|||||||
item.cached_availability[0],
|
item.cached_availability[0],
|
||||||
item.cached_availability[1] if self.request.event.settings.show_quota_left else None
|
item.cached_availability[1] if self.request.event.settings.show_quota_left else None
|
||||||
] if not item.has_variations else None,
|
] if not item.has_variations else None,
|
||||||
'original_price': item.original_price,
|
'original_price': (
|
||||||
|
(item.original_price.net
|
||||||
|
if self.request.event.settings.display_net_prices
|
||||||
|
else item.original_price.gross)
|
||||||
|
if item.original_price else None
|
||||||
|
),
|
||||||
'variations': [
|
'variations': [
|
||||||
{
|
{
|
||||||
'id': var.id,
|
'id': var.id,
|
||||||
@@ -208,7 +213,19 @@ class WidgetAPIProductList(EventListMixin, View):
|
|||||||
'order_max': var.order_max,
|
'order_max': var.order_max,
|
||||||
'description': str(rich_text(var.description, safelinks=False)) if var.description else None,
|
'description': str(rich_text(var.description, safelinks=False)) if var.description else None,
|
||||||
'price': price_dict(item, var.display_price),
|
'price': price_dict(item, var.display_price),
|
||||||
'original_price': getattr(var, 'original_price') or item.original_price,
|
'original_price': (
|
||||||
|
(
|
||||||
|
var.original_price.net
|
||||||
|
if self.request.event.settings.display_net_prices
|
||||||
|
else var.original_price.gross
|
||||||
|
) if var.original_price else None
|
||||||
|
) or (
|
||||||
|
(
|
||||||
|
item.original_price.net
|
||||||
|
if self.request.event.settings.display_net_prices
|
||||||
|
else item.original_price.gross
|
||||||
|
) if item.original_price else None
|
||||||
|
),
|
||||||
'avail': [
|
'avail': [
|
||||||
var.cached_availability[0],
|
var.cached_availability[0],
|
||||||
var.cached_availability[1] if self.request.event.settings.show_quota_left else None
|
var.cached_availability[1] if self.request.event.settings.show_quota_left else None
|
||||||
|
|||||||
Reference in New Issue
Block a user