Introduce a setting to show net prices (#415)

* Introduce a setting to show net prices in the frontend

* Show net prices in the backend as well
This commit is contained in:
Raphael Michel
2017-02-22 16:59:54 +01:00
committed by GitHub
parent 08e7a29623
commit ed04f3124f
16 changed files with 206 additions and 43 deletions

View File

@@ -9,6 +9,7 @@ from django.db.models import Q
from django.utils.timezone import now
from django.utils.translation import ugettext as _
from pretix.base.decimal import round_decimal
from pretix.base.i18n import LazyLocaleException
from pretix.base.models import (
CartPosition, Event, Item, ItemVariation, Voucher,
@@ -143,6 +144,8 @@ class CartManager:
custom_price = Decimal(custom_price.replace(",", "."))
if custom_price > 100000000:
return error_messages['price_too_high']
if self.event.settings.display_net_prices:
custom_price = round_decimal(custom_price * (100 + item.tax_rate) / 100)
price = max(custom_price, price)
return price