{% load i18n creme_widgets creme_bricks %} {% load has_perm_to format_amount url from creme_core_tags %} {% has_perm_to change object as edit_perm %} {% with line=form.instance currency=object.currency %} {# FIRST LINE #} {% with exclusive_of_tax=line.get_price_exclusive_of_tax inclusive_of_tax=line.get_price_inclusive_of_tax %} {% if edit_perm %} {% else %}{# READONLY VERSION #} {% endif %} {% endwith %} {# SECOND LINE #} {% if edit_perm %} {% else %}{# READONLY VERSION #} {% endif %}
{% translate 'Quantity' %} {% translate 'Unit price' %} {% translate 'Unit' %} {% translate 'Discount' %} {% translate 'VAT' %} {% translate 'Total (exclusive of tax)' %} {% translate 'Total (without tax) discounted' %} {% translate 'Total (inclusive of tax)' %}
{{form.quantity}} {{form.unit_price}} {{object.currency.local_symbol}} / {{form.unit}} {{form.discount}} {{form.discount_unit}} {{form.vat_value}} {{line.get_raw_price|format_amount:currency}} {{exclusive_of_tax|format_amount:currency}} {{inclusive_of_tax|format_amount:currency}}{{line.quantity}} {{line.unit_price}} {{object.currency.local_symbol}} {% if line.unit %} / {{line.unit}}{% endif %} {{line.discount}} {% with sel_dunit=form.fields.discount_unit.initial %}{% for dunit, label in form.fields.discount_unit.choices %}{% if dunit == sel_dunit %}{{label}}{% endif %}{% endfor %}{% endwith %} {{line.vat_value}} {{line.get_raw_price|format_amount:currency}} {{exclusive_of_tax|format_amount:currency}} {{inclusive_of_tax|format_amount:currency}}
{{related_item_label}} {% translate 'Comment' %}
{% if line.pk %} {% with related_item=line.related_item %} {% if related_item %} {% widget_entity_hyperlink related_item user %} {% else %}
{% has_perm_to create related_item_ct as item_create_perm %} {{form.on_the_fly_item}} {# brick_table_action ?? (beware to is-disabled class => need .brick-table .brick-table-content) #} {% brick_action id='edit' url='billing__add_to_catalog'|url:line.id label=_('[add to catalog]') display='text' enabled=item_create_perm %}
{% endif %} {% endwith %} {% else %} {{form.on_the_fly_item}} {% endif %}
{{form.comment}} {% if line.pk %} {% with related_item=line.related_item %} {% if related_item %} {% widget_entity_hyperlink related_item user %} {% else %}
{% has_perm_to create related_item_ct as item_create_perm %} {{line.on_the_fly_item}} {% brick_action id='edit' url='billing__add_to_catalog'|url:line.id label=_('[add to catalog]') display='text' enabled=item_create_perm %}
{% endif %} {% endwith %} {% endif %}
{{line.comment|linebreaks}}
{% endwith %}