forked from CGM_Public/pretix_original
@@ -17,7 +17,6 @@ from django.views import View
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from pretix.base.decimal import round_decimal
|
||||
from pretix.base.models import ItemVariation
|
||||
from pretix.base.models.event import SubEvent
|
||||
from pretix.multidomain.urlreverse import eventreverse
|
||||
@@ -53,7 +52,7 @@ def get_grouped_items(event, subevent=None):
|
||||
& Q(hide_without_voucher=False)
|
||||
& ~Q(category__is_addon=True)
|
||||
).select_related(
|
||||
'category', # for re-grouping
|
||||
'category', 'tax_rule', # for re-grouping
|
||||
).prefetch_related(
|
||||
Prefetch('quotas',
|
||||
to_attr='_subevent_quotas',
|
||||
@@ -88,17 +87,9 @@ def get_grouped_items(event, subevent=None):
|
||||
item.order_max = min(item.cached_availability[1]
|
||||
if item.cached_availability[1] is not None else sys.maxsize,
|
||||
max_per_order)
|
||||
item.price = item.default_price
|
||||
price = item.default_price
|
||||
item.display_price = item.tax(item_price_override.get(item.pk, price))
|
||||
|
||||
if event.settings.display_net_prices:
|
||||
if item_price_override.get(item.pk):
|
||||
_p = item_price_override.get(item.pk)
|
||||
tax_value = round_decimal(_p * (1 - 100 / (100 + item.tax_rate)))
|
||||
item.display_price = _p - tax_value
|
||||
else:
|
||||
item.display_price = item.default_price_net
|
||||
else:
|
||||
item.display_price = item_price_override.get(item.pk, item.price)
|
||||
display_add_to_cart = display_add_to_cart or item.order_max > 0
|
||||
else:
|
||||
for var in item.available_variations:
|
||||
@@ -107,15 +98,7 @@ def get_grouped_items(event, subevent=None):
|
||||
if var.cached_availability[1] is not None else sys.maxsize,
|
||||
max_per_order)
|
||||
|
||||
if event.settings.display_net_prices:
|
||||
if var_price_override.get(var.pk):
|
||||
_p = var_price_override.get(var.pk)
|
||||
tax_value = round_decimal(_p * (1 - 100 / (100 + item.tax_rate)))
|
||||
var.display_price = _p - tax_value
|
||||
else:
|
||||
var.display_price = var.net_price
|
||||
else:
|
||||
var.display_price = var_price_override.get(var.pk, var.price)
|
||||
var.display_price = var.tax(var_price_override.get(var.pk, var.price))
|
||||
|
||||
display_add_to_cart = display_add_to_cart or var.order_max > 0
|
||||
|
||||
@@ -123,8 +106,10 @@ def get_grouped_items(event, subevent=None):
|
||||
v for v in item.available_variations if v._subevent_quotas
|
||||
]
|
||||
if len(item.available_variations) > 0:
|
||||
item.min_price = min([v.display_price for v in item.available_variations])
|
||||
item.max_price = max([v.display_price for v in item.available_variations])
|
||||
item.min_price = min([v.display_price.net if event.settings.display_net_prices else
|
||||
v.display_price.gross for v in item.available_variations])
|
||||
item.max_price = max([v.display_price.net if event.settings.display_net_prices else
|
||||
v.display_price.gross for v in item.available_variations])
|
||||
item._remove = not bool(item.available_variations)
|
||||
|
||||
items = [item for item in items
|
||||
|
||||
Reference in New Issue
Block a user