Compare commits

...
Author SHA1 Message Date
Raphael Michel 09fada1afb Allow sales-channels to add information to invoice settings
Yes, this is oddly specific, but we spent days finding another way out
to make sense of this toggle since neither True nor False are truly
useful. Now, let's recommend False and allow posbackend to overrule it.
2026-11-06 09:58:47 +01:00
4 changed files with 27 additions and 10 deletions

No files matched your search

+10 -1
View File
@@ -22,6 +22,7 @@
import logging
import warnings
from collections import OrderedDict
from typing import Optional
from django.dispatch import receiver
from django.utils.translation import gettext_lazy as _
@@ -124,12 +125,20 @@ class SalesChannelType:
return True
@property
def required_event_plugin(self) -> str:
def required_event_plugin(self) -> Optional[str]:
"""
Name of an event plugin that is required for this sales channel to be useful. Defaults to ``None``.
"""
return
@property
def invoice_setting_suffix(self) -> Optional[str]:
"""
Label for the sales channel selection in invoicing settings to add a e.g. a "recommended" or
"not recommended" flag.
"""
return
def get_all_sales_channel_types():
from pretix.base.signals import register_sales_channel_types
+13 -5
View File
@@ -46,7 +46,7 @@ from django.db.models import Prefetch, Q, prefetch_related_objects
from django.forms import formset_factory, inlineformset_factory
from django.urls import reverse
from django.utils.functional import cached_property, lazy
from django.utils.html import escape, format_html
from django.utils.html import conditional_escape, escape, format_html
from django.utils.safestring import mark_safe
from django.utils.timezone import get_current_timezone_name
from django.utils.translation import gettext, gettext_lazy as _, pgettext_lazy
@@ -1091,7 +1091,7 @@ class InvoiceSettingsForm(EventSettingsValidationMixin, SettingsForm):
]
invoice_generate_sales_channels = forms.MultipleChoiceField(
label=_('Generate invoices for Sales channels'),
label=_('Sales channels to generate invoices for'),
choices=[],
widget=forms.CheckboxSelectMultiple,
help_text=_("If you have enabled invoice generation in the previous setting, you can limit it here to specific "
@@ -1121,9 +1121,17 @@ class InvoiceSettingsForm(EventSettingsValidationMixin, SettingsForm):
self.fields['invoice_numbers_prefix_cancellations'].widget.attrs['placeholder'] = event.slug.upper() + '-'
locale_names = dict(settings.LANGUAGES)
self.fields['invoice_language'].choices = [('__user__', _('The user\'s language'))] + [(a, locale_names[a]) for a in event.settings.locales]
self.fields['invoice_generate_sales_channels'].choices = (
(c.identifier, c.label) for c in event.organizer.sales_channels.all()
)
self.fields['invoice_generate_sales_channels'].choices = [
(
c.identifier,
mark_safe(
'{} {}'.format(
conditional_escape(c.label),
conditional_escape(c.type_instance.invoice_setting_suffix or '')
).strip()
)
) for c in event.organizer.sales_channels.all()
]
pps = [str(pp.verbose_name) for pp in event.get_payment_providers().values() if pp.requires_invoice_immediately]
if pps:
generate_paid_help_text = _('An invoice will be issued before payment if the customer selects one of the following payment methods: {list}').format(
+2 -2
View File
@@ -14478,8 +14478,8 @@ msgstr ""
"erreichbar sind."
#: pretix/control/forms/event.py
msgid "Generate invoices for Sales channels"
msgstr "Rechnungen nur für bestimmte Verkaufskanäle generieren"
msgid "Sales channels to generate invoices for"
msgstr "Verkaufskanäle mit Rechnungsgenerierung"
#: pretix/control/forms/event.py
msgid ""
@@ -10562,8 +10562,8 @@ msgstr ""
"angegebenen „letzten Zahlungsdatum“ akzeptiert."
#: pretix/base/settings.py
msgid "Allow postponed payment choice for sales channels"
msgstr "Erlaube aufgeschobene Entscheidung der Zahlungsart für Verkaufskanäle"
msgid "Sales channels to generate invoices for"
msgstr "Verkaufskanäle mit Rechnungsgenerierung"
#: pretix/base/settings.py
msgid ""