{% load i18n creme_bricks creme_perms creme_widgets %} {% load format_amount url from creme_core_tags %} {% with edit_perm=user|has_perm_to_change:object line=form.instance currency=object.currency %}
{% 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}} | {% else %}{# READONLY VERSION #}{{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}} | {% endif %} {% endwith %}
{{related_item_label}} | {% translate 'Comment' %} | ||||||||||||||
{% if line.pk %}
{% with related_item=line.related_item %}
{% if related_item %}
{% widget_entity_hyperlink related_item user %}
{% else %}
{{form.on_the_fly_item}}
{# brick_table_action ?? (beware of 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=user|has_perm_to_create:related_item_ct %}
{% endif %}
{% endwith %}
{% else %}
{{form.on_the_fly_item}}
{% endif %}
|
{{form.comment}} | {% else %}{# READONLY VERSION #}
{% if line.pk %}
{% with related_item=line.related_item %}
{% if related_item %}
{% widget_entity_hyperlink related_item user %}
{% else %}
{{line.on_the_fly_item}}
{% brick_action id='edit' url='billing__add_to_catalog'|url:line.id label=_('[add to catalog]') display='text' enabled=user|has_perm_to_create:related_item_ct %}
{% endif %}
{% endwith %}
{% endif %}
|
{{line.comment|linebreaks}} | {% endif %}