Conditional Print Format

Is there currently any way to control the templates that are available to print a given document based on conditions? i.e. different format based on status, based on permissions, etc. I’d rather not have to come up with a “super template” that covers my use case :slight_smile:

Thats an interesting option. Add it to GitHub Issues - if it finds more support, we may build it. :smile:

Hello @jvermette,

I am making a similar check. Mine is a bit different but probably the same result. Why not have jinja conditionals embedded in the heading for instance so I can print the status and change its color based on what I find. For example.

{% if doc.status == ‘Paid’ %}
color -= “Red”
{% elif doc.status == ‘Unpaid’ %}
color = “Green”
{% endif %}

Sales Invoice
{{ doc.name }}

{{ doc.status }}

It is obviously returning html so this seems impossible from this part of the formatting.

Is there an hidden gem somewhere to achieve this?

Thanks

Hmmm. I think I have an idea. I could create hidden form field or something and probably incorporate the code there and set the color variable. I think this should do the trick.

1 Like