From 370130f047159335e64f599c08b1c9675becbcaa Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 26 Nov 2019 16:41:41 +0100 Subject: [PATCH] Add signal invoice_line_text --- src/pretix/base/services/invoices.py | 5 ++++- src/pretix/base/signals.py | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pretix/base/services/invoices.py b/src/pretix/base/services/invoices.py index a888bfd63e..b6e79d50ed 100644 --- a/src/pretix/base/services/invoices.py +++ b/src/pretix/base/services/invoices.py @@ -24,7 +24,7 @@ from pretix.base.models import Invoice, InvoiceAddress, InvoiceLine, Order from pretix.base.models.tax import EU_CURRENCIES from pretix.base.services.tasks import TransactionAwareTask from pretix.base.settings import GlobalSettingsObject -from pretix.base.signals import periodic_task +from pretix.base.signals import invoice_line_text, periodic_task from pretix.celery_app import app from pretix.helpers.database import rolledback_transaction from pretix.helpers.models import modelcopy @@ -139,6 +139,9 @@ def build_invoice(invoice: Invoice) -> Invoice: desc = " + " + desc if invoice.event.settings.invoice_attendee_name and p.attendee_name: desc += "
" + pgettext("invoice", "Attendee: {name}").format(name=p.attendee_name) + for recv, resp in invoice_line_text.send(sender=invoice.event, position=p): + if resp: + desc += "
" + resp for answ in p.answers.all(): if not answ.question.print_on_invoice: diff --git a/src/pretix/base/signals.py b/src/pretix/base/signals.py index e58fd50493..6411965c2c 100644 --- a/src/pretix/base/signals.py +++ b/src/pretix/base/signals.py @@ -622,3 +622,11 @@ order_split = EventPluginSignal( This signal is sent out when an order is split into two orders and allows you to copy related models to the new order. You will be passed the old order as ``original`` and the new order as ``split_order``. """ + +invoice_line_text = EventPluginSignal( + providing_args=["position"] +) +""" +This signal is sent out when an invoice is built for an order. You can return additional text that +should be shown on the invoice for the given ``position``. +"""