Remove "None" from print

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.

Here’s the code:

Here’s the print preview with the standard print format:

Here’s the print with the custom print format:

Here’s the print format with your code:

Here’s the print view for the format with your code:(shows a blank screen)

Print view with standard format is the same, none shows up

There is no “None”. So what is the issue?

Go through this tutorial to get an idea on how to create custom print formats: [Tutorial] Creating print formats