{% extends "base.html" %} {% comment %} SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n crispy_forms_tags %} {% block content %}

{{ title }}

{% if object.pk and not object.locked %}
{% blocktrans trimmed %} Warning: the LaTeX template is saved with this object. Updating the invoice implies regenerate it. Be careful if you manipulate old invoices. {% endblocktrans %}
{% elif object.locked %}
{% blocktrans trimmed %} This invoice is locked and can no longer be edited. {% endblocktrans %}
{% endif %}
{% csrf_token %} {# Render the invoice form #}
{% crispy form %}
{# The next part concerns the product formset #} {# Generate some hidden fields that manage the number of products, and make easier the parsing #} {{ formset.management_form }} {# Fill initial data #} {% for form in formset %} {% if forloop.first %} {% endif %} {# These fields are hidden but handled by the formset to link the id and the invoice id #} {{ form.invoice }} {{ form.id }} {% endfor %}
{{ form.designation.label }}* {{ form.quantity.label }}* {{ form.amount.label }}*
{{ form.designation }} {{ form.quantity }} {{ form.amount }}
{# Display buttons to add and remove products #}
{% if not object.locked %}
{% endif %}
{# Hidden div that store an empty product form, to be copied into new forms #} {% endblock %} {% block extrajavascript %} {% endblock %}