Show field by condition in print format

Hello everyone,

I’m currently in the last steps of the customization of my print format.
Nearly everything is finished, but the discount functionality is still missing.

How I want it to be:
Not every quotation/invoice includes a discount, but if I include a discount into my quotation/invoice I want it to be shown in the generated PDF aswell - of course I guess.

Therefor I am searching for the possibility/functionality of checking if the discount field contains any (added) value and only if this is the case, I want the discount section (basically one line added to the table) to be visible in my pdf.
Otherwise it should not only be hidden but also should not take up any place.

Is something like this possible and has anyone an idea how to solve this?

Thank you in advance and best regards!

In your print format
{% if doc.discount %}
doc.discount
{% endif %}

Make sure the field name is correct

1 Like