forked from CGM_Public/pretix_original
Backend UX: Use actual tax rates for invoice preview
This commit is contained in:
@@ -265,11 +265,20 @@ def build_preview_invoice_pdf(event):
|
|||||||
invoice.save()
|
invoice.save()
|
||||||
invoice.lines.all().delete()
|
invoice.lines.all().delete()
|
||||||
|
|
||||||
InvoiceLine.objects.create(
|
if event.tax_rules.exists():
|
||||||
invoice=invoice, description=_("Sample product A"),
|
for i, tr in enumerate(event.tax_rules.all()):
|
||||||
gross_value=119, tax_value=19,
|
tax = tr.tax(Decimal('100.00'))
|
||||||
tax_rate=19
|
InvoiceLine.objects.create(
|
||||||
)
|
invoice=invoice, description=_("Sample product {}").format(i + 1),
|
||||||
|
gross_value=tax.gross, tax_value=tax.tax,
|
||||||
|
tax_rate=tax.rate
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
InvoiceLine.objects.create(
|
||||||
|
invoice=invoice, description=_("Sample product A"),
|
||||||
|
gross_value=100, tax_value=0, tax_rate=0
|
||||||
|
)
|
||||||
|
|
||||||
return event.invoice_renderer.generate(invoice)
|
return event.invoice_renderer.generate(invoice)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user