mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Add "Invoice" to the filename of attached invoices
This commit is contained in:
@@ -16,7 +16,7 @@ from celery import chain
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.mail import EmailMultiAlternatives, get_connection
|
from django.core.mail import EmailMultiAlternatives, get_connection
|
||||||
from django.template.loader import get_template
|
from django.template.loader import get_template
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import pgettext, ugettext as _
|
||||||
from django_scopes import scope, scopes_disabled
|
from django_scopes import scope, scopes_disabled
|
||||||
from i18nfield.strings import LazyI18nString
|
from i18nfield.strings import LazyI18nString
|
||||||
|
|
||||||
@@ -261,11 +261,12 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
|
|||||||
for inv in invoices:
|
for inv in invoices:
|
||||||
if inv.file:
|
if inv.file:
|
||||||
try:
|
try:
|
||||||
email.attach(
|
with language(inv.order.language):
|
||||||
'{}.pdf'.format(inv.number),
|
email.attach(
|
||||||
inv.file.file.read(),
|
pgettext('invoice', 'Invoice {num}').format(num=inv.number).replace(' ', '_') + '.pdf',
|
||||||
'application/pdf'
|
inv.file.file.read(),
|
||||||
)
|
'application/pdf'
|
||||||
|
)
|
||||||
except:
|
except:
|
||||||
logger.exception('Could not attach invoice to email')
|
logger.exception('Could not attach invoice to email')
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user