refactor: desk missing doc handling

- reduce 1 query
- make normal and virtual doc behave in same manner
This commit is contained in:
Ankush Menat 2022-07-22 16:32:45 +05:30
parent 0285d4f686
commit d11fdc3ca4

View file

@ -31,10 +31,11 @@ def getdoc(doctype, name, user=None):
if not name:
name = doctype
if not is_virtual_doctype(doctype) and not frappe.db.exists(doctype, name):
try:
doc = frappe.get_doc(doctype, name)
except frappe.DoesNotExistError:
return []
doc = frappe.get_doc(doctype, name)
run_onload(doc)
if not doc.has_permission("read"):