forked from CGM_Public/pretix_original
Add reverse charge flag to invoices
This commit is contained in:
18
src/pretix/base/migrations/0101_auto_20181025_2255.py
Normal file
18
src/pretix/base/migrations/0101_auto_20181025_2255.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 2.1 on 2018-10-25 22:55
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pretixbase', '0100_auto_20181023_2300'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='invoice',
|
||||||
|
name='reverse_charge',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -93,6 +93,7 @@ class Invoice(models.Model):
|
|||||||
locale = models.CharField(max_length=50, default='en')
|
locale = models.CharField(max_length=50, default='en')
|
||||||
introductory_text = models.TextField(blank=True)
|
introductory_text = models.TextField(blank=True)
|
||||||
additional_text = models.TextField(blank=True)
|
additional_text = models.TextField(blank=True)
|
||||||
|
reverse_charge = models.BooleanField(default=False)
|
||||||
payment_provider_text = models.TextField(blank=True)
|
payment_provider_text = models.TextField(blank=True)
|
||||||
footer_text = models.TextField(blank=True)
|
footer_text = models.TextField(blank=True)
|
||||||
foreign_currency_display = models.CharField(max_length=50, null=True, blank=True)
|
foreign_currency_display = models.CharField(max_length=50, null=True, blank=True)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ from django.dispatch import receiver
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from django.utils.translation import pgettext, ugettext as _
|
from django.utils.translation import pgettext, ugettext as _
|
||||||
|
from django_countries.fields import Country
|
||||||
from i18nfield.strings import LazyI18nString
|
from i18nfield.strings import LazyI18nString
|
||||||
|
|
||||||
from pretix.base.i18n import language
|
from pretix.base.i18n import language
|
||||||
@@ -152,6 +153,7 @@ def build_invoice(invoice: Invoice) -> Invoice:
|
|||||||
"Reverse Charge: According to Article 194, 196 of Council Directive 2006/112/EEC, VAT liability "
|
"Reverse Charge: According to Article 194, 196 of Council Directive 2006/112/EEC, VAT liability "
|
||||||
"rests with the service recipient."
|
"rests with the service recipient."
|
||||||
)
|
)
|
||||||
|
invoice.reverse_charge = True
|
||||||
invoice.save()
|
invoice.save()
|
||||||
|
|
||||||
offset = len(positions)
|
offset = len(positions)
|
||||||
@@ -297,7 +299,15 @@ def build_preview_invoice_pdf(event):
|
|||||||
invoice.additional_text = str(additional).replace('\n', '<br />')
|
invoice.additional_text = str(additional).replace('\n', '<br />')
|
||||||
invoice.footer_text = str(footer)
|
invoice.footer_text = str(footer)
|
||||||
invoice.payment_provider_text = str(payment).replace('\n', '<br />')
|
invoice.payment_provider_text = str(payment).replace('\n', '<br />')
|
||||||
invoice.invoice_to = _("John Doe\n214th Example Street\n012345 Somecity")
|
invoice.invoice_to_name = _("John Doe")
|
||||||
|
invoice.invoice_to_street = _("214th Example Street")
|
||||||
|
invoice.invoice_to_zipcode = _("012345")
|
||||||
|
invoice.invoice_to_city = _('Sample city')
|
||||||
|
invoice.invoice_to_country = Country('DE')
|
||||||
|
invoice.invoice_to = '{}\n{}\n{} {}'.format(
|
||||||
|
invoice.invoice_to_name, invoice.invoice_to_street,
|
||||||
|
invoice.invoice_to_zipcode, invoice.invoice_to_city
|
||||||
|
)
|
||||||
invoice.file = None
|
invoice.file = None
|
||||||
invoice.save()
|
invoice.save()
|
||||||
invoice.lines.all().delete()
|
invoice.lines.all().delete()
|
||||||
|
|||||||
Reference in New Issue
Block a user