mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Add subevent information to invoices
This commit is contained in:
@@ -282,16 +282,19 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
|||||||
preserveAspectRatio=True, anchor='n',
|
preserveAspectRatio=True, anchor='n',
|
||||||
mask='auto')
|
mask='auto')
|
||||||
|
|
||||||
if self.invoice.event.settings.show_date_to:
|
if not self.invoice.event.has_subevents:
|
||||||
p_str = (
|
if self.invoice.event.settings.show_date_to:
|
||||||
str(self.invoice.event.name) + '\n' + pgettext('invoice', '{from_date}\nuntil {to_date}').format(
|
p_str = (
|
||||||
from_date=self.invoice.event.get_date_from_display(),
|
str(self.invoice.event.name) + '\n' + pgettext('invoice', '{from_date}\nuntil {to_date}').format(
|
||||||
to_date=self.invoice.event.get_date_to_display())
|
from_date=self.invoice.event.get_date_from_display(),
|
||||||
)
|
to_date=self.invoice.event.get_date_to_display())
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
p_str = (
|
||||||
|
str(self.invoice.event.name) + '\n' + self.invoice.event.get_date_from_display()
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
p_str = (
|
p_str = str(self.invoice.event.name)
|
||||||
str(self.invoice.event.name) + '\n' + self.invoice.event.get_date_from_display()
|
|
||||||
)
|
|
||||||
|
|
||||||
p = Paragraph(p_str.strip().replace('\n', '<br />\n'), style=self.stylesheet['Normal'])
|
p = Paragraph(p_str.strip().replace('\n', '<br />\n'), style=self.stylesheet['Normal'])
|
||||||
p.wrapOn(canvas, 65 * mm, 50 * mm)
|
p.wrapOn(canvas, 65 * mm, 50 * mm)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ def build_invoice(invoice: Invoice) -> Invoice:
|
|||||||
invoice.lines.all().delete()
|
invoice.lines.all().delete()
|
||||||
|
|
||||||
positions = list(
|
positions = list(
|
||||||
invoice.order.positions.select_related('addon_to', 'item', 'tax_rule', 'variation').annotate(
|
invoice.order.positions.select_related('addon_to', 'item', 'tax_rule', 'subevent', 'variation').annotate(
|
||||||
addon_c=Count('addons')
|
addon_c=Count('addons')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -111,6 +111,8 @@ def build_invoice(invoice: Invoice) -> Invoice:
|
|||||||
desc = " + " + desc
|
desc = " + " + desc
|
||||||
if invoice.event.settings.invoice_attendee_name and p.attendee_name:
|
if invoice.event.settings.invoice_attendee_name and p.attendee_name:
|
||||||
desc += "<br />" + pgettext("invoice", "Attendee: {name}").format(name=p.attendee_name)
|
desc += "<br />" + pgettext("invoice", "Attendee: {name}").format(name=p.attendee_name)
|
||||||
|
if invoice.event.has_subevents:
|
||||||
|
desc += "<br />" + pgettext("subevent", "Date: {}").format(p.subevent)
|
||||||
InvoiceLine.objects.create(
|
InvoiceLine.objects.create(
|
||||||
position=i, invoice=invoice, description=desc,
|
position=i, invoice=invoice, description=desc,
|
||||||
gross_value=p.price, tax_value=p.tax_value,
|
gross_value=p.price, tax_value=p.tax_value,
|
||||||
|
|||||||
Reference in New Issue
Block a user