Remove "None" from print

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

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

Looks like the print is working fine, the reason for the blank print you see is because doc.firma is None

A blank screen?

Um is that fixable? Ive found a temporary fix, instead of leaving empty labels just add an empty space but thats kinda tedious, I have over 23 documents with the same issue and over 200+ fields each

@Vesper_Solutions

Here is the code you need

{% if doc.“field_name” %}{{doc.field_name}}{% else %}“-”{% endif %}

{% else %} “Leave it blank if you want” {% endif %}

Try

{{ doc.get_formatted("firma") }}

{{ field_name or ’ ’ }}