Remove "None" from print

I have some fields without the label. When printing their label shows up as “None”. I added this code to the print format of the doctype. I made it a custom format and added it to the HTML section.

code:

<br><div>
{% if doc.firma %}
  {{ doc.firma }}<br>
{% endif %}
</div>

yet however “None” is still showing up.

Try this (or “”):

<br><div>
{% if doc.firma %}
  {{ doc.firma or ""}}<br>
{% endif %}
</div>

Doesn’t work :pensive::pensive:

{{ doc.firma or “” }}

the space after the “” and before }} is important

Nope still doesn’t work :pensive:
Here’s the code:



{% if doc.firma %}
{{ doc.firma }}

{% endif %}

I did add the comma’s and the space, yet when i saved the format, the commas disappeared. Also when copying they disappeared.

Just curious - shouldn’t there be an “else” ???

Where exactly?

if doc.firma - then doc.firma - seems that works when there is data… else “” - so prints “” if no doc.firma - so before the
/ endif.

If nothing works then try this one:

<br><div>
{% if (doc.firma) or (doc.firma !='')  %}
  {{ doc.firma }}<br>
{% else %}
{% endif %}
</div>
1 Like

You don’t need an if condition at all.

<br>
<div>
    {{ doc.firma or '' }}<br>
</div>
1 Like

Doesn’t work :pensive:

Which solution doesn’t work? Mine is tested and works fine.
Maybe None comes from some other part of code? Check and verify.

I copied your code to my print format. None still shows up. None also does not come from code because I created the doctype, I wrote no code for it

Try this…

{% if doc.firma is not none %}
{{doc.firma}}
{% endif %}

Nope, not working :pensive: Here’s my screenshot :

Try changing print format type from JS to Jinja

1 Like

Tried it, doesn’t work

This solution is tested and works fine.
Select Jinja and not JS in print format type.

1 Like

Not working for me hence I said not working. I read the previous comments and hence did change to jinja, this works for a few fields, after which the whole none thing begins repeating.

I can’t magically find out why its not working. Provide screenshot of your code and the preview of the print format so that we have something to look at.