Repository: frappe/frappe

Issue:
Cannot search for keywords via Global Search
Steps:

1. Enter any keyword in global search
2. Hit enter
3. Instead of returning relevant records, system throws error message for Relevant Doctype

![image](https://user-images.githubusercontent.com/33246109/144895257-654ecb0e-e849-4087-b3f3-037219c67c77.png)

```
Traceback (most recent call last):
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/app.py", line 66, in application
    response = frappe.api.handle()
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/handler.py", line 31, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/handler.py", line 67, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/__init__.py", line 1213, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/utils/global_search.py", line 422, in search
    allowed_doctypes = get_doctypes_for_global_search()
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/desk/doctype/global_search_settings/global_search_settings.py", line 39, in get_doctypes_for_global_search
    return frappe.cache().hget("global_search", "search_priorities", get_from_db)
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 194, in hget
    value = generator()
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/desk/doctype/global_search_settings/global_search_settings.py", line 36, in get_from_db
    doctypes = frappe.get_list("Global Search DocType", fields=["document_type"], order_by="idx ASC")
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/__init__.py", line 1446, in get_list
    return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/model/db_query.py", line 40, in execute
    not frappe.has_permission(self.doctype, "select", user=user, parent_doctype=parent_doctype) and \
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/__init__.py", line 743, in has_permission
    raise_exception=throw, parent_doctype=parent_doctype)
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/permissions.py", line 24, in inner
    result = func(*args, **kwargs)
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/permissions.py", line 55, in has_permission
    user, raise_exception, parent_doctype)
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/permissions.py", line 585, in has_child_table_permission
    ), title=_("Parent DocType Required"))
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/__init__.py", line 438, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/__init__.py", line 417, in msgprint
    _raise_exception()
  File "/home/frappe/frappe-io-bench/apps/frappe/frappe/__init__.py", line 371, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: Please specify a valid parent DocType for <strong>Global Search DocType</strong>
```

ERPNext: v13.x.x-develop () (develop)

Frappe Framework: v14.x.x-develop () (develop)




Discussion:

Resolving patch:
diff --git a/frappe/desk/doctype/global_search_settings/global_search_settings.py b/frappe/desk/doctype/global_search_settings/global_search_settings.py
--- a/frappe/desk/doctype/global_search_settings/global_search_settings.py
+++ b/frappe/desk/doctype/global_search_settings/global_search_settings.py
@@ -33,7 +33,7 @@ def validate(self):
 
 def get_doctypes_for_global_search():
 	def get_from_db():
-		doctypes = frappe.get_list("Global Search DocType", fields=["document_type"], order_by="idx ASC")
+		doctypes = frappe.get_all("Global Search DocType", fields=["document_type"], order_by="idx ASC")
 		return [d.document_type for d in doctypes] or []
 
 	return frappe.cache().hget("global_search", "search_priorities", get_from_db)


Test patch: