Error when printing Material Request

Hi all, I got this error as I was trying to print a pdf of a material request. Any idea how to solve this?

Traceback (innermost last):
File “/home/franky1/frappe-bench/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/home/franky1/frappe-bench/apps/frappe/frappe/api.py”, line 50, in handle
return frappe.handler.handle()
File “/home/franky1/frappe-bench/apps/frappe/frappe/handler.py”, line 19, in handle
execute_cmd(cmd)
File “/home/franky1/frappe-bench/apps/frappe/frappe/handler.py”, line 36, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/franky1/frappe-bench/apps/frappe/frappe/init.py”, line 805, in call
return fn(*args, **newargs)
File “/home/franky1/frappe-bench/apps/frappe/frappe/templates/pages/print.py”, line 180, in download_pdf
html = frappe.get_print(doctype, name, format)
File “/home/franky1/frappe-bench/apps/frappe/frappe/init.py”, line 1027, in get_print
html = build_page(“print”)
File “/home/franky1/frappe-bench/apps/frappe/frappe/website/render.py”, line 127, in build_page
context = get_context(path)
File “/home/franky1/frappe-bench/apps/frappe/frappe/website/context.py”, line 16, in get_context
context = build_context(context)
File “/home/franky1/frappe-bench/apps/frappe/frappe/website/context.py”, line 58, in build_context
ret = module.get_context(context)
File “/home/franky1/frappe-bench/apps/frappe/frappe/templates/pages/print.py”, line 29, in get_context
doc = frappe.get_doc(frappe.form_dict.doctype, frappe.form_dict.name)
File “/home/franky1/frappe-bench/apps/frappe/frappe/init.py”, line 533, in get_doc
return frappe.model.document.get_doc(arg1, arg2)
File “/home/franky1/frappe-bench/apps/frappe/frappe/model/document.py”, line 46, in get_doc
return controller(arg1, arg2)
File “/home/franky1/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 20, in init
super(AccountsController, self).init(arg1, arg2)
File “/home/franky1/frappe-bench/apps/frappe/frappe/model/document.py”, line 79, in init
self.load_from_db()
File “/home/franky1/frappe-bench/apps/frappe/frappe/model/document.py”, line 110, in load_from_db
frappe.throw(("{0} {1} not found").format((self.doctype), self.name), frappe.DoesNotExistError)
File “/home/franky1/frappe-bench/apps/frappe/frappe/init.py”, line 264, in throw
msgprint(msg, raise_exception=exc)
File “/home/franky1/frappe-bench/apps/frappe/frappe/init.py”, line 257, in msgprint
_raise_exception()
File “/home/franky1/frappe-bench/apps/frappe/frappe/init.py”, line 242, in _raise_exception
raise raise_exception, encode(msg)
DoesNotExistError: Material Request New Material Request 1 not found

The error comes if I try to print / pdf before I save. Once the doc is saved, there is no more error. (just a small bug?)

Yeah this should be stopped. PDF is generated server-side, so unless its saved, you can’t do this.