Allow to set multiple email invoice recipients (Z#23190766) (#5090)

This commit is contained in:
Raphael Michel
2025-05-13 10:31:07 +02:00
committed by GitHub
parent 47c840b9e5
commit 5bc1fb8e81
2 changed files with 9 additions and 4 deletions

View File

@@ -531,7 +531,7 @@ def send_invoices_to_organizer(sender, **kwargs):
if i.event.settings.invoice_email_organizer: if i.event.settings.invoice_email_organizer:
with language(i.event.settings.locale): with language(i.event.settings.locale):
mail( mail(
email=i.event.settings.invoice_email_organizer, email=[e.strip() for e in i.event.settings.invoice_email_organizer.split(",")],
subject=_('New invoice: {number}').format(number=i.number), subject=_('New invoice: {number}').format(number=i.number),
template=LazyI18nString.from_gettext(_( template=LazyI18nString.from_gettext(_(
'Hello,\n\n' 'Hello,\n\n'

View File

@@ -71,6 +71,7 @@ from pretix.base.reldate import (
RelativeDateField, RelativeDateTimeField, RelativeDateWrapper, RelativeDateField, RelativeDateTimeField, RelativeDateWrapper,
SerializerRelativeDateField, SerializerRelativeDateTimeField, SerializerRelativeDateField, SerializerRelativeDateTimeField,
) )
from pretix.base.validators import multimail_validate
from pretix.control.forms import ( from pretix.control.forms import (
ExtFileField, FontSelect, MultipleLanguagesWidget, SingleLanguageWidget, ExtFileField, FontSelect, MultipleLanguagesWidget, SingleLanguageWidget,
) )
@@ -1233,14 +1234,18 @@ DEFAULTS = {
'invoice_email_organizer': { 'invoice_email_organizer': {
'default': '', 'default': '',
'type': str, 'type': str,
'form_class': forms.EmailField, 'form_class': forms.CharField,
'serializer_class': serializers.EmailField, 'serializer_class': serializers.CharField,
'form_kwargs': dict( 'form_kwargs': dict(
label=_("Email address to receive a copy of each invoice"), label=_("Email address to receive a copy of each invoice"),
help_text=_("Each newly created invoice will be sent to this email address shortly after creation. You can " help_text=_("Each newly created invoice will be sent to this email address shortly after creation. You can "
"use this for an automated import of invoices to your accounting system. The invoice will be " "use this for an automated import of invoices to your accounting system. The invoice will be "
"the only attachment of the email."), "the only attachment of the email."),
) validators=[multimail_validate],
),
'serializer_kwargs': dict(
validators=[multimail_validate],
),
}, },
'show_items_outside_presale_period': { 'show_items_outside_presale_period': {
'default': 'True', 'default': 'True',