"AttributeError: 'NoneType' object has no attribute 'fieldtype'"

App Versions

{
	"erpnext": "14.0.0-dev",
	"frappe": "14.0.0-dev",
	"hrms": "0.0.1",
	"india_compliance": "0.0.1",
	"payments": "0.0.1"
}

Route

print/Print Format/GST Tax Invoice

Trackeback

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 1597, 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 "apps/frappe/frappe/templates/print_formats/standard.html", line 32, in top-level template code
    {{ render_field(df, doc, no_of_cols) }}
  File "env/lib/python3.10/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
  File "env/lib/python3.10/site-packages/jinja2/runtime.py", line 777, in _invoke
    rv = self._func(*arguments)
  File "apps/frappe/frappe/templates/print_formats/standard_macros.html", line 5, in template
    <div>{{ frappe.render_template(df.options, {"doc": doc}) or "" }}</div>
  File "env/lib/python3.10/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
  File "apps/frappe/frappe/utils/jinja.py", line 85, in render_template
    return get_jenv().from_string(template).render(context)
  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 "<template>", line 21, 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 1098, in get_formatted
    df.fieldtype == "Currency"
AttributeError: 'NoneType' object has no attribute 'fieldtype'

Request Data

{
	"type": "POST",
	"args": {
		"doc": "{\"name\":\"e-Waybill\",\"owner\":\"Administrator\",\"creation\":\"2022-03-27 16:32:27.037976\",\"modified\":\"2022-04-12 11:05:49.333577\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":0,\"doc_type\":\"e-Waybill Log\",\"module\":\"GST India\",\"default_print_language\":\"en\",\"standard\":\"Yes\",\"custom_format\":0,\"disabled\":0,\"print_format_type\":\"Jinja\",\"raw_printing\":0,\"html\":\"\",\"margin_top\":0,\"margin_bottom\":0,\"margin_left\":0,\"margin_right\":0,\"align_labels_right\":0,\"show_section_headings\":0,\"line_breaks\":0,\"absolute_value\":0,\"font_size\":14,\"page_number\":\"Hide\",\"print_format_builder\":0,\"print_format_builder_beta\":0,\"doctype\":\"Print Format\",\"__onload\":{\"print_templates\":[]},\"__last_sync_on\":\"2022-08-20T17:48:07.833Z\"}",
		"print_format": "Standard",
		"no_letterhead": 0,
		"letterhead": "Default Letter-head",
		"settings": "{}",
		"_lang": "en"
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.www.printview.get_html_and_style"
}

Response Data

{
	"exception": "AttributeError: 'NoneType' object has no attribute 'fieldtype'"
}

I am getting the above error while printing sales invoices using any sales invoice print format and it is not limited to sales invoice only, anything wanted to print getting the same error. Tried bench build and migrate. pls help me to get it resolve. @ shashank_shirke

Up ! Every got this resolved ?

@Ulter52 @deajan Same error. Any luck?

Actually I could solve this.
Issue was a field in Print Format from earlier version of ERPnext. Namely irn_cancelled, when I removed things where working fine.

How I reached to the conclusion.
The detailed error log was present in error log list inside app. (it’s much more detailed).

At the end I could see irn_cancelled field out of several.

However error was related to Currency.

So had a doubt that some logic on currency determination of field was failing due to irn_cancellation field