diff --git a/src/pretix/base/models/event.py b/src/pretix/base/models/event.py
index 9a42ffaa9..22981b0ef 100644
--- a/src/pretix/base/models/event.py
+++ b/src/pretix/base/models/event.py
@@ -369,6 +369,7 @@ class Event(EventMixin, LoggedModel):
This way, we can use this to introduce new default settings to pretix that do not affect existing events.
"""
self.settings.invoice_renderer = 'modern1'
+ self.settings.invoice_include_expire_date = True
@property
def social_image(self):
diff --git a/src/pretix/base/services/invoices.py b/src/pretix/base/services/invoices.py
index 662d7f194..3ca827d38 100644
--- a/src/pretix/base/services/invoices.py
+++ b/src/pretix/base/services/invoices.py
@@ -13,6 +13,7 @@ from django.db import transaction
from django.db.models import Count
from django.dispatch import receiver
from django.utils import timezone
+from django.utils.formats import date_format
from django.utils.timezone import now
from django.utils.translation import pgettext, ugettext as _
from django_countries.fields import Country
@@ -52,11 +53,17 @@ def build_invoice(invoice: Invoice) -> Invoice:
footer = invoice.event.settings.get('invoice_footer_text', as_type=LazyI18nString)
if lp and lp.payment_provider:
if 'payment' in inspect.signature(lp.payment_provider.render_invoice_text).parameters:
- payment = lp.payment_provider.render_invoice_text(invoice.order, lp)
+ payment = str(lp.payment_provider.render_invoice_text(invoice.order, lp))
else:
- payment = lp.payment_provider.render_invoice_text(invoice.order)
+ payment = str(lp.payment_provider.render_invoice_text(invoice.order))
else:
payment = ""
+ if invoice.event.settings.invoice_include_expire_date and invoice.order.status == Order.STATUS_PENDING:
+ if payment:
+ payment += "
"
+ payment += pgettext("invoice", "Please complete your payment before {expire_date}.").format(
+ expire_date=date_format(invoice.order.expires, "SHORT_DATE_FORMAT")
+ )
invoice.introductory_text = str(introductory).replace('\n', '
')
invoice.additional_text = str(additional).replace('\n', '
')
diff --git a/src/pretix/base/settings.py b/src/pretix/base/settings.py
index 2786c2b93..c87cf874d 100644
--- a/src/pretix/base/settings.py
+++ b/src/pretix/base/settings.py
@@ -85,6 +85,10 @@ DEFAULTS = {
'default': 'True',
'type': bool,
},
+ 'invoice_include_expire_date': {
+ 'default': 'False',
+ 'type': bool,
+ },
'invoice_numbers_consecutive': {
'default': 'True',
'type': bool,
diff --git a/src/pretix/control/forms/event.py b/src/pretix/control/forms/event.py
index b2c6a4e4f..a475e080e 100644
--- a/src/pretix/control/forms/event.py
+++ b/src/pretix/control/forms/event.py
@@ -870,6 +870,11 @@ class InvoiceSettingsForm(SettingsForm):
label=_("Show attendee names on invoices"),
required=False
)
+ invoice_include_expire_date = forms.BooleanField(
+ label=_("Show expiration date of order"),
+ help_text=_("The expiration date will not be shown if the invoice is generated after the order is paid."),
+ required=False
+ )
invoice_email_attachment = forms.BooleanField(
label=_("Attach invoices to emails"),
help_text=_("If invoices are automatically generated for all orders, they will be attached to the order "
diff --git a/src/pretix/control/templates/pretixcontrol/event/invoicing.html b/src/pretix/control/templates/pretixcontrol/event/invoicing.html
index 2c4cbb719..a36b60eeb 100644
--- a/src/pretix/control/templates/pretixcontrol/event/invoicing.html
+++ b/src/pretix/control/templates/pretixcontrol/event/invoicing.html
@@ -42,6 +42,7 @@
{% bootstrap_field form.invoice_renderer layout="control" %}
{% bootstrap_field form.invoice_attendee_name layout="control" %}
+ {% bootstrap_field form.invoice_include_expire_date layout="control" %}
{% bootstrap_field form.invoice_introductory_text layout="control" %}
{% bootstrap_field form.invoice_additional_text layout="control" %}
{% bootstrap_field form.invoice_footer_text layout="control" %}