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/”, line 60, in application
response = frappe.api.handle()
File “/home/franky1/frappe-bench/apps/frappe/frappe/”, line 50, in handle
return frappe.handler.handle()
File “/home/franky1/frappe-bench/apps/frappe/frappe/”, line 19, in handle
File “/home/franky1/frappe-bench/apps/frappe/frappe/”, line 36, in execute_cmd
ret =, **frappe.form_dict)
File “/home/franky1/frappe-bench/apps/frappe/frappe/”, line 805, in call
return fn(*args, **newargs)
File “/home/franky1/frappe-bench/apps/frappe/frappe/templates/pages/”, line 180, in download_pdf
html = frappe.get_print(doctype, name, format)
File “/home/franky1/frappe-bench/apps/frappe/frappe/”, line 1027, in get_print
html = build_page(“print”)
File “/home/franky1/frappe-bench/apps/frappe/frappe/website/”, line 127, in build_page
context = get_context(path)
File “/home/franky1/frappe-bench/apps/frappe/frappe/website/”, line 16, in get_context
context = build_context(context)
File “/home/franky1/frappe-bench/apps/frappe/frappe/website/”, line 58, in build_context
ret = module.get_context(context)
File “/home/franky1/frappe-bench/apps/frappe/frappe/templates/pages/”, line 29, in get_context
doc = frappe.get_doc(frappe.form_dict.doctype,
File “/home/franky1/frappe-bench/apps/frappe/frappe/”, line 533, in get_doc
return frappe.model.document.get_doc(arg1, arg2)
File “/home/franky1/frappe-bench/apps/frappe/frappe/model/”, line 46, in get_doc
return controller(arg1, arg2)
File “/home/franky1/frappe-bench/apps/erpnext/erpnext/controllers/”, line 20, in init
super(AccountsController, self).init(arg1, arg2)
File “/home/franky1/frappe-bench/apps/frappe/frappe/model/”, line 79, in init
File “/home/franky1/frappe-bench/apps/frappe/frappe/model/”, line 110, in load_from_db
frappe.throw((“{0} {1} not found”).format((self.doctype),, frappe.DoesNotExistError)
File “/home/franky1/frappe-bench/apps/frappe/frappe/”, line 264, in throw
msgprint(msg, raise_exception=exc)
File “/home/franky1/frappe-bench/apps/frappe/frappe/”, line 257, in msgprint
File “/home/franky1/frappe-bench/apps/frappe/frappe/”, 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.