Version-14 Custom Print format - Console

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 69, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 45, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 83, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “apps/frappe/frappe/init.py”, line 1587, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/www/printview.py”, line 294, in get_html_and_style
html = get_rendered_template(
File “apps/frappe/frappe/www/printview.py”, line 207, in get_rendered_template
html = template.render(args, filters={“len”: len})
File “env/lib/python3.10/site-packages/jinja2/environment.py”, line 1301, in render
self.environment.handle_exception()
File “env/lib/python3.10/site-packages/jinja2/environment.py”, line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File “”, line 142, in top-level template code
File “env/lib/python3.10/site-packages/jinja2/sandbox.py”, line 393, in call
return __context.call(__obj, *args, **kwargs)
File “apps/frappe/frappe/model/base_document.py”, line 1094, in get_formatted
df.fieldtype == “Currency”
AttributeError: ‘NoneType’ object has no attribute ‘fieldtype’

I have litterally the same error (including line numbers) after a ERPNext 13 to 14 upgrade.
Anyone found what to do ?

Any solutions ?

1 Like

Hi everybody, I have the same problem, any solution?

It means fieldname you are using does not exists in table. Pass the correct fieldname in doc.get_formatted().

1 Like

Thank you, the field was still in custom print format, but after removing it, the issue was resolved.