ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

AttributeError: 'NoneType' object has no attribute 'get' print format V13

Getting error on custom print format

Traceback (most recent call last):
  File "/home/midocean/frappe-bench/apps/frappe/frappe/app.py", line 68, in application
    response = frappe.api.handle()
  File "/home/midocean/frappe-bench/apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "/home/midocean/frappe-bench/apps/frappe/frappe/handler.py", line 31, in handle
    data = execute_cmd(cmd)
  File "/home/midocean/frappe-bench/apps/frappe/frappe/handler.py", line 67, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/midocean/frappe-bench/apps/frappe/frappe/__init__.py", line 1174, in call
    return fn(*args, **newargs)
  File "/home/midocean/frappe-bench/apps/frappe/frappe/www/printview.py", line 198, in get_html_and_style
    html = get_rendered_template(doc, name=name, print_format=print_format, meta=meta,
  File "/home/midocean/frappe-bench/apps/frappe/frappe/www/printview.py", line 168, in get_rendered_template
    html = template.render(args, filters={"len": len})
  File "/home/midocean/frappe-bench/env/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/home/midocean/frappe-bench/env/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/home/midocean/frappe-bench/env/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 100, in top-level template code
  File "/home/midocean/frappe-bench/env/lib/python3.8/site-packages/jinja2/sandbox.py", line 462, in call
    return __context.call(__obj, *args, **kwargs)
  File "/home/midocean/frappe-bench/apps/frappe/frappe/model/base_document.py", line 868, in get_formatted
    currency = self.get(df.get("options"))
AttributeError: 'NoneType' object has no attribute 'get'

I seem to be facing a similar issue. Were you able to resolve this?

Send screen shots and print format code so will identify where it comes from?

@ishanloya and @Sagar_Bhogayata Please double check field names you used in print format

Am getting same error V13.4. I’ve checked all fields in my print format and they’re all valid. Anybody have any clue?

Update: Found the culprit. It’s not liking field name tc_name even though you can find it in the doctype Sales Invoice. Removed it and it works.