diff --git a/src/pretix/base/exporters/orderlist.py b/src/pretix/base/exporters/orderlist.py index 6d75261cad..c1066a51e5 100644 --- a/src/pretix/base/exporters/orderlist.py +++ b/src/pretix/base/exporters/orderlist.py @@ -559,6 +559,7 @@ class InvoiceDataExporter(MultiSheetListExporter): _('Tax value'), _('Tax rate'), _('Tax name'), + _('Event start date'), _('Date'), _('Order code'), @@ -598,6 +599,7 @@ class InvoiceDataExporter(MultiSheetListExporter): l.tax_value, l.tax_rate, l.tax_name, + date_format(l.event_date_from, "SHORT_DATE_FORMAT") if l.event_date_from else "", date_format(i.date, "SHORT_DATE_FORMAT"), i.order.code, i.order.email, diff --git a/src/pretix/base/models/invoices.py b/src/pretix/base/models/invoices.py index 8094bc0b51..7e3a38d463 100644 --- a/src/pretix/base/models/invoices.py +++ b/src/pretix/base/models/invoices.py @@ -212,6 +212,10 @@ class InvoiceLine(models.Model): :type tax_rate: decimal.Decimal :param tax_name: The name of the applied tax rate :type tax_name: str + :param subevent: The subevent this line refers to + :type subevent: SubEvent + :param event_date_from: Event date of the (sub)event at the time the invoice was created + :type event_date_from: datetime """ invoice = models.ForeignKey('Invoice', related_name='lines', on_delete=models.CASCADE) position = models.PositiveIntegerField(default=0) @@ -220,6 +224,8 @@ class InvoiceLine(models.Model): tax_value = models.DecimalField(max_digits=10, decimal_places=2, default=Decimal('0.00')) tax_rate = models.DecimalField(max_digits=7, decimal_places=2, default=Decimal('0.00')) tax_name = models.CharField(max_length=190) + subevent = models.ForeignKey('SubEvent', null=True, blank=True, on_delete=models.PROTECT) + event_date_from = models.DateTimeField(null=True) @property def net_value(self): diff --git a/src/pretix/base/services/invoices.py b/src/pretix/base/services/invoices.py index ba9248a9d0..f765a20c71 100644 --- a/src/pretix/base/services/invoices.py +++ b/src/pretix/base/services/invoices.py @@ -142,6 +142,7 @@ def build_invoice(invoice: Invoice) -> Invoice: InvoiceLine.objects.create( position=i, invoice=invoice, description=desc, gross_value=p.price, tax_value=p.tax_value, + subevent=p.subevent, event_date_from=(p.subevent.date_from if p.subevent else invoice.event.date_from), tax_rate=p.tax_rate, tax_name=p.tax_rule.name if p.tax_rule else '' )