Print Render is not functioning properly

Hello. I have created some custom print formats, all of which are throwing the following error:

Traceback (most recent call last):
  File "apps/frappe/frappe/website/serve.py", line 18, in get_response
    response = renderer_instance.render()
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 84, in render
    html = self.get_html()
  File "apps/frappe/frappe/website/utils.py", line 510, in cache_html_decorator
    html = func(*args, **kwargs)
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 95, in get_html
    self.update_context()
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 163, in update_context
    data = self.run_pymodule_method("get_context")
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 225, in run_pymodule_method
    return method(self.context)
  File "apps/frappe/frappe/www/printview.py", line 52, in get_context
    body = get_rendered_template(
  File "apps/frappe/frappe/www/printview.py", line 154, in get_rendered_template
    format_data_map[df.get("fieldname")] = df
AttributeError: 'str' object has no attribute 'get'

Can someone guide what is wrong? They used to work before. The default print format works fine. The error is thrown only when I select the print button, not during the preview.

Hi @Dishant_Shah,

Please share your code if you want.
Community will help you!

Thank You!

I have not modified the source code as such outside the dashboard. So can you guide me which part of the source code might help and how to navigate to it inside the erpnext folder?

Which version do you use?

If you use a custom print format without code then it should work.
For the cross-checking please try on another doctype means creating a new custom print format for it and then reloading and checking it.

Thank You!

I have attached the screenshot of the “about” popup. I will try to create a new print format and see if that works. It might be time-consuming but will work probably. Duplicating does not work - gives the same errors.

Hmm :thinking:,

Please upgrade your version 14 because now erpnext running on

ERPNext: v14.38.0 (version-14)
Frappe Framework: v14.48.1 (version-14)

[EDIT]:
First, take a backup and then upgrade the version.

Thank You!

I am facing the same issue again after updating erpnext to v15. This is quite frustrating as everytime something updates the print render function stops working. Which package or module is used for this feature?

There are different ways to add a print format (I know two).

  1. tools > print > program to create new print formats
  2. tools > print > print format builder (new)

Is it possible that you are using the second one? I experienced the same problem when trying that and switched back to the “old” one. That works great.
Unfortunately I didn’t find a solution and I didn’t do much research because of the alternative.