mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
Invoice exporter: Add order ID to filename
This commit is contained in:
@@ -66,7 +66,7 @@ class InvoiceExporterMixin:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def invoices_queryset(self, form_data: dict):
|
def invoices_queryset(self, form_data: dict):
|
||||||
qs = Invoice.objects.filter(event__in=self.events)
|
qs = Invoice.objects.filter(event__in=self.events).select_related('order')
|
||||||
|
|
||||||
if form_data.get('payment_provider'):
|
if form_data.get('payment_provider'):
|
||||||
qs = qs.annotate(
|
qs = qs.annotate(
|
||||||
@@ -112,13 +112,13 @@ class InvoiceExporter(InvoiceExporterMixin, BaseExporter):
|
|||||||
invoice_pdf_task.apply(args=(i.pk,))
|
invoice_pdf_task.apply(args=(i.pk,))
|
||||||
i.refresh_from_db()
|
i.refresh_from_db()
|
||||||
i.file.open('rb')
|
i.file.open('rb')
|
||||||
zipf.writestr('{}.pdf'.format(i.number), i.file.read())
|
zipf.writestr('{}-{}.pdf'.format(i.number, i.order.code), i.file.read())
|
||||||
i.file.close()
|
i.file.close()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
invoice_pdf_task.apply(args=(i.pk,))
|
invoice_pdf_task.apply(args=(i.pk,))
|
||||||
i.refresh_from_db()
|
i.refresh_from_db()
|
||||||
i.file.open('rb')
|
i.file.open('rb')
|
||||||
zipf.writestr('{}.pdf'.format(i.number), i.file.read())
|
zipf.writestr('{}-{}.pdf'.format(i.number, i.order.code), i.file.read())
|
||||||
i.file.close()
|
i.file.close()
|
||||||
counter += 1
|
counter += 1
|
||||||
if total and counter % max(10, total // 100) == 0:
|
if total and counter % max(10, total // 100) == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user