From b9feceba497579fc0e056f1cb36e8389ced34d30 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 15 Aug 2022 14:54:51 +0200 Subject: [PATCH] Do not show a price if there are mandatory non-free addons --- .../pretixpresale/event/fragment_product_list.html | 12 ++++++++---- src/pretix/presale/views/event.py | 9 ++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html b/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html index f8c600b0b..cc60c07eb 100644 --- a/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html +++ b/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html @@ -58,9 +58,9 @@ {% endblocktrans %} - {% elif not item.min_price and not item.max_price %} + {% elif not item.min_price and not item.max_price and not item.mandatory_priced_addons %} {% trans "free" context "price" %} - {% else %} + {% elif not item.mandatory_priced_addons %} {{ item.min_price|money:event.currency }} {% endif %} @@ -144,7 +144,9 @@

{% elif not var.display_price.gross %} - {% trans "free" context "price" %} + {% if not item.mandatory_priced_addons %} + {% trans "free" context "price" %} + {% endif %} {% elif event.settings.display_net_prices %} {{ var.display_price.net|money:event.currency }} {% else %} @@ -276,7 +278,9 @@

{% elif not item.display_price.gross %} - {% trans "free" context "price" %} + {% if not item.mandatory_priced_addons %} + {% trans "free" context "price" %} + {% endif %} {% elif event.settings.display_net_prices %} {{ item.display_price.net|money:event.currency }} {% else %} diff --git a/src/pretix/presale/views/event.py b/src/pretix/presale/views/event.py index 08577ae65..18b0658ce 100644 --- a/src/pretix/presale/views/event.py +++ b/src/pretix/presale/views/event.py @@ -65,7 +65,7 @@ from pretix.base.models import ( ) from pretix.base.models.event import SubEvent from pretix.base.models.items import ( - ItemBundle, SubEventItem, SubEventItemVariation, + ItemAddOn, ItemBundle, SubEventItem, SubEventItemVariation, ) from pretix.base.services.quotas import QuotaAvailability from pretix.helpers.compat import date_fromisocalendar @@ -183,6 +183,13 @@ def get_grouped_items(event, subevent=None, voucher=None, channel='web', require subevent=subevent, ) ), + mandatory_priced_addons=Exists( + ItemAddOn.objects.filter( + base_item_id=OuterRef('pk'), + min_count__gte=1, + price_included=False + ) + ), requires_seat=requires_seat, ).filter( quotac__gt=0, subevent_disabled=False,