Compare commits

...

1 Commits

Author SHA1 Message Date
Raphael Michel
a59a1b02d8 Invoice generation: Add way for renderers to signal they are not ready 2026-02-18 15:05:10 +01:00
2 changed files with 6 additions and 1 deletions

View File

@@ -148,6 +148,10 @@ class NumberedCanvas(Canvas):
self.restoreState()
class InvoiceNotReadyException(Exception):
pass
class BaseInvoiceRenderer:
"""
This is the base class for all invoice renderers.

View File

@@ -51,6 +51,7 @@ from django_scopes import scope, scopes_disabled
from i18nfield.strings import LazyI18nString
from pretix.base.i18n import language
from pretix.base.invoicing.pdf import InvoiceNotReadyException
from pretix.base.invoicing.transmission import (
get_transmission_types, transmission_providers,
)
@@ -504,7 +505,7 @@ def generate_invoice(order: Order, trigger_pdf=True):
return invoice
@app.task(base=TransactionAwareTask)
@app.task(base=TransactionAwareTask, throws=(InvoiceNotReadyException,))
def invoice_pdf_task(invoice: int):
with scopes_disabled():
i = Invoice.objects.get(pk=invoice)