fix: Apply full perm logic on global search (#37400)

Co-authored-by: AarDG10 <aarol.dsouza@gmail.com>
This commit is contained in:
Ankush Menat 2026-02-23 17:55:27 +05:30 committed by GitHub
parent c3781f1bd7
commit 85e0fdaa6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -530,14 +530,16 @@ def search(text: str, start: int = 0, limit: int = 20, doctype: str = ""):
if r.doctype == doctype and r.rank > 0.0:
try:
meta = frappe.get_meta(r.doctype)
doc = frappe.get_lazy_doc(r.doctype, r.name)
if meta.image_field:
r.image = frappe.db.get_value(r.doctype, r.name, meta.image_field)
r.image = doc.get(meta.image_field)
if meta.title_field:
r.title = frappe.db.get_value(r.doctype, r.name, meta.title_field)
r.title = doc.get(meta.title_field)
except Exception:
frappe.clear_messages()
sorted_results.extend([r])
if doc.has_permission():
sorted_results.append(r)
return sorted_results