Browse Source

Merge pull request #4087 from pratu16x7/hotfix

[hotfix] global search: ignore results with non-existent doctypes
version-14
Rushabh Mehta 7 years ago
committed by GitHub
parent
commit
64b81cffc9
4 changed files with 11 additions and 3 deletions
  1. +1
    -0
      frappe/patches.txt
  2. +0
    -0
      frappe/patches/v8_10/__init__.py
  3. +5
    -0
      frappe/patches/v8_10/delete_static_web_page_from_global_search.py
  4. +5
    -3
      frappe/utils/global_search.py

+ 1
- 0
frappe/patches.txt View File

@@ -192,3 +192,4 @@ frappe.patches.v8_5.delete_email_group_member_with_invalid_emails
frappe.patches.v8_x.update_user_permission
frappe.patches.v8_5.patch_event_colors
frappe.patches.v8_7.update_email_queue_status
frappe.patches.v8_10.delete_static_web_page_from_global_search

+ 0
- 0
frappe/patches/v8_10/__init__.py View File


+ 5
- 0
frappe/patches/v8_10/delete_static_web_page_from_global_search.py View File

@@ -0,0 +1,5 @@
from __future__ import unicode_literals
import frappe

def execute():
frappe.db.sql("""delete from `__global_search` where doctype='Static Web Page'""");

+ 5
- 3
frappe/utils/global_search.py View File

@@ -307,9 +307,11 @@ def search(text, start=0, limit=20, doctype=""):
limit {start}, {limit}'''.format(start=start, limit=limit), (doctype, text), as_dict=True)

for r in results:
if frappe.get_meta(r.doctype).image_field:
doc = frappe.get_doc(r.doctype, r.name)
r.image = doc.get(doc.meta.image_field)
try:
if frappe.get_meta(r.doctype).image_field:
r.image = frappe.db.get_value(r.doctype, r.name, frappe.get_meta(r.doctype).image_field)
except Exception:
frappe.clear_messages()

return results



Loading…
Cancel
Save