diff --git a/pretix_zugferd/apps.py b/pretix_zugferd/apps.py index b456d0b..146247a 100644 --- a/pretix_zugferd/apps.py +++ b/pretix_zugferd/apps.py @@ -23,21 +23,6 @@ def description(self): "This plugin provides an invoice renderer that annotates pretix invoices with ZUGFeRD data, " "a structured data format for invoices used in Germany." ) - t += '
' - t += gettext( - "ZUGFeRD is a complicated format and the automatic conversion of invoices does not work in all possible " - "situations. The result quality will depend on the exact settings in use such as payment providers and needs " - "to be verified individually." - ) - t += "
" - t += '
' - t += gettext( - "Note: Use this plugin at your own risk. If there is a semantic difference between the XML and PDF " - "contents in your ZUGFeRD invoices, you might legally owe the VAT to the financial authorities twice, " - "since you then legally sent two invoices. We tried our best to avoid this, but we do not assume " - "any liability. Please check the output of this plugin with your tax or legal attorney before use." - ) - t += "
" return mark_safe(t) def ready(self): diff --git a/pretix_zugferd/templates/pretix_zugferd/settings.html b/pretix_zugferd/templates/pretix_zugferd/settings.html index 5be5571..70276dd 100644 --- a/pretix_zugferd/templates/pretix_zugferd/settings.html +++ b/pretix_zugferd/templates/pretix_zugferd/settings.html @@ -2,14 +2,305 @@ {% load i18n %} {% load bootstrap3 %} {% block inside %} -

{% trans "ZUGFeRD" %}

-
- {% url "control:event.settings.invoice" event=request.event.slug organizer=request.organizer.slug as settings_url %} - {% blocktrans trimmed with settings_url=settings_url|add:"#tab-0-3-open" %} - If you want to use the XRechnung profile, you should make use of the "custom recipient field" in invoice settings - for the buyer reference ID. Also make sure to use a compatible invoice layout (+ ZUGFeRD) in your invoice settings. +

{% trans "ZUGFeRD invoices" %}

+ +

{% trans "Configuration check" %}

+

+ {% blocktrans trimmed %} + We've checked the configuration of your event for compatibility with ZUGFeRD invoices and found the result + shown in the following table. Note that this check can only cover usual cases and it is ultimately your + responsibility that the resulting ZUGFeRD invoices comply with all regulations they might need to. + ZUGFeRD invoices need to be machine-readable. This also means that all important information on the + invoice must only be in the pre-defined fields and information included in unstructured text should not + conflicht with the structured information. {% endblocktrans %} -

+

+

+ {% blocktrans trimmed %} + We recommend inspecting a sample invoice with one of the many available validation tools and discussing + the results with your tax accountant to make sure you are fully in compliance with tax regulations. + Note that some invoice recipients, such as government customers, might impose stricter requirements than + what is required by tax law. + {% endblocktrans %} +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{% trans "Setting" %}{% trans "Status" %}
{% trans "Invoice generation" %} + {% if not request.event.settings.invoice_generate %} + + {% trans "Invoice generation is not enabled for your event." %} + {% trans "ZUGFeRD invoices cannot be created." %} + + {% trans "Change" %} + + {% else %} + + {% trans "Invoice generation is enabled." %} + {% endif %} +
{% trans "Invoice style" %} + {% if not is_zugferd_renderer %} + + {% trans "You have not selected a ZUGFeRD-enabled invoice renderer." %} + {% trans "ZUGFeRD invoices cannot be created." %} + + {% trans "Change" %} + + {% else %} + + {% trans "A ZUGFeRD-enabled invoice renderer is active." %} + {% endif %} +
{% trans "Seller address" %} + {% if not request.event.settings.invoice_address_from_country %} + + {% trans "No country is set for the invoice sender address." %} + {% trans "ZUGFeRD invoices cannot be created." %} + + {% trans "Change" %} + + {% else %} + + {% trans "Configuration is set." %} + {% endif %} +
{% trans "Seller VAT ID" %} + {% if not request.event.settings.invoice_address_from_vat_id %} + + {% trans "Your VAT ID is not set." %} + {% trans "ZUGFeRD invoices can be created, but will likely be rejected as invalid." %} + + {% trans "Change" %} + + {% else %} + + {% trans "Configuration is set." %} + {% endif %} +
{% trans "Invoice addresses" %} + {% if not request.event.settings.invoice_address_asked %} + + {% trans "Invoice addresses are not asked." %} + {% trans "ZUGFeRD invoices cannot be created." %} + + {% trans "Change" %} + + {% elif not request.event.settings.invoice_address_required %} + + {% trans "Invoice addresses are not required." %} + {% trans "ZUGFeRD invoices can only be created if an invoice address is entered." %} + + {% trans "Change" %} + + {% else %} + + {% trans "Configuration is set." %} + {% endif %} +
{% trans "VAT IDs" %} + {% if not request.event.settings.invoice_address_vatid %} + + {% trans "Customers cannot enter a VAT ID." %} + {% trans "ZUGFeRD invoices can be created, but will likely be rejected as invalid." %} + + {% trans "Change" %} + + {% else %} + + {% trans "Configuration is set." %} + {% endif %} +
{% trans "Beneficiary" %} + {% if request.event.settings.invoice_address_beneficiary %} + + {% trans "You have enabled the option to allow customers to name a different beneficiary." %} + {% trans "This is not currently supported by this module and the beneficiary will not be included in the XML part of the ZUGFeRD invoice." %} + {% trans "We recommend disabling this option." %} + + {% trans "Change" %} + + {% else %} + + {% trans "Configuration is not set." %} + {% endif %} +
{% trans "Custom texts" %} + {% if request.event.settings.invoice_introductory_text or request.event.settings.invoice_additional_text %} + + {% blocktrans trimmed %} + You have entered content in the individual invoice text fields. + The texts will be included in the electronic invoice as well, but be aware that a customer who + processes the electronic invoices automatically might not take them into account. Make sure they do + not include vital details on payment or taxation matters. + {% endblocktrans %} + + {% trans "Change" %} + + {% else %} + + {% trans "No custom texts used." %} + {% endif %} +
{% trans "Footer text" %} + {% if not request.event.settings.invoice_footer_text %} + + {% blocktrans trimmed %} + You have not entered a footer text. Make sure your invoice contains all relevant regulatory + information (e.g. registration numbers, management board) on both the PDF and XML part of the + ZUGFeRD invoice. + {% endblocktrans %} + + {% trans "Change" %} + + {% else %} + + {% trans "Configuration is set." %} + {% endif %} +
{% trans "Payment deadline" %} + {% if not request.event.settings.invoice_include_expire_date %} + + {% blocktrans trimmed %} + You have configured invoices not to show the payment deadline. ZUGFeRD invoices will, + however, always include the payment deadline in the XML part, so we recommend showing it on the + PDF part as well. + {% endblocktrans %} + + {% trans "Change" %} + + {% else %} + + {% trans "Configuration is set." %} + {% endif %} +
{% trans "Seller contact" %} + {% if not request.event.settings.zugferd_seller_contact_name or not request.event.settings.zugferd_seller_contact_email or not request.event.settings.zugferd_seller_contact_phone %} + + {% trans "X-Rechnung is active, but no seller contact is given." %} + {% trans "ZUGFeRD invoices can be created, but will likely be rejected as invalid." %} + + {% trans "Change" %} + + {% elif not is_xrechnung_renderer %} + + {% trans "X-Rechnung is not active." %} + {% trans "ZUGFeRD invoices will be valid electronic invoices but might not be accepted by German governmental customers." %} + + {% trans "Change" %} + + {% else %} + + {% trans "Configuration is set." %} + {% endif %} +
{% trans "Leitweg IDs" %} + {% if is_xrechnung_renderer and not has_leitweg_id %} + + {% trans "X-Rechnung is active, but customers cannot enter a Leitweg ID." %} + {% trans "If you expect German governmental customers, we recommend using the custom field to allow them to enter a Leitweg ID." %} + + {% trans "Change" %} + + {% elif not is_xrechnung_renderer %} + + {% trans "X-Rechnung is not active." %} + {% trans "ZUGFeRD invoices will be valid electronic invoices but might not be accepted by German governmental customers." %} + + {% trans "Change" %} + + {% else %} + + {% trans "Configuration is set." %} + {% endif %} +
{% trans "Tax rules" %} + {% if not tax_rules_used %} + + {% trans "Not all products use a tax rule." %} + {% trans "pretix will need to guess the correct tax handling for your invoice." %} + {% trans "Please configure explicit tax rules to avoid incorrect invoices." %} + + {% trans "Change" %} + + {% elif not tax_codes_used %} + + {% trans "Not all tax rule have a tax code set." %} + {% trans "pretix will need to guess the correct tax handling for your invoice." %} + {% trans "Please configure a tax code for every tax rule including all custom rules to avoid incorrect invoices." %} + + {% trans "Change" %} + + {% else %} + + {% trans "Configuration is set." %} + {% endif %} +
+ +

{% trans "Settings" %}

{% csrf_token %} {% bootstrap_form_errors form %} diff --git a/pretix_zugferd/views.py b/pretix_zugferd/views.py index ac66ece..06deb07 100644 --- a/pretix_zugferd/views.py +++ b/pretix_zugferd/views.py @@ -6,6 +6,8 @@ from pretix.base.models import Event from pretix.control.views.event import EventSettingsFormView, EventSettingsViewMixin +from pretix_zugferd.invoice import ZugferdMixin + class ZugferdSettingsForm(SettingsForm): zugferd_seller_contact_name = forms.CharField( @@ -48,3 +50,27 @@ def get_success_url(self) -> str: "event": self.request.event.slug, }, ) + + def get_context_data(self, **kwargs): + return super().get_context_data( + **kwargs, + is_zugferd_renderer=isinstance( + self.request.event.invoice_renderer, ZugferdMixin + ), + is_xrechnung_renderer=( + getattr(self.request.event.invoice_renderer, "profile", None) + == "XRECHNUNG" + ), + has_leitweg_id=( + self.request.event.settings.invoice_address_custom_field.localize("de") + and "leitweg" + in self.request.event.settings.invoice_address_custom_field.localize( + "de" + ).lower() + ), + tax_rules_used=not self.request.event.tax_rules.exists() + or not self.request.event.items.filter(tax_rule__isnull=True).exists(), + tax_codes_used=not self.request.event.tax_rules.filter( + code__isnull=True + ).exists(), + )