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/", line 68, in application
    response = frappe.api.handle()
  File "/home/midocean/frappe-bench/apps/frappe/frappe/", line 54, in handle
    return frappe.handler.handle()
  File "/home/midocean/frappe-bench/apps/frappe/frappe/", line 31, in handle
    data = execute_cmd(cmd)
  File "/home/midocean/frappe-bench/apps/frappe/frappe/", line 67, in execute_cmd
    return, **frappe.form_dict)
  File "/home/midocean/frappe-bench/apps/frappe/frappe/", line 1174, in call
    return fn(*args, **newargs)
  File "/home/midocean/frappe-bench/apps/frappe/frappe/www/", 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/", 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/", line 1090, in render
  File "/home/midocean/frappe-bench/env/lib/python3.8/site-packages/jinja2/", line 832, in handle_exception
  File "/home/midocean/frappe-bench/env/lib/python3.8/site-packages/jinja2/", 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/", line 462, in call
    return, *args, **kwargs)
  File "/home/midocean/frappe-bench/apps/frappe/frappe/model/", 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.

Bumping this up. Am running into errors again. Where do you get the definitive field names when doing Print Formats / Jinja Template? I tried using the database field names or DocType Field Names and I’m still getting NoneType Errors ( field I’m referrring to is tax_id under Doctype Sales Invoice). Please help!

Also, I’m getting an error when doing the following:

{%- set u = frappe.get_doc(“Address”, doc.customer_address) -%}

where the Sales Invoice was created with a Customer with no address. Is there a function that allows capturing an error so that we can have it gracefully continue printing without an address?

Please help. Much thanks!!