[fix] ignore results with non-existent doctypes
This commit is contained in:
parent
ba38e945c1
commit
0aaaca9b1a
4 changed files with 14 additions and 3 deletions
|
|
@ -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
frappe/patches/v8_10/__init__.py
Normal file
0
frappe/patches/v8_10/__init__.py
Normal 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'""");
|
||||
|
|
@ -307,9 +307,14 @@ 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)
|
||||
if not frappe.db.exists("Doctype", r.doctype):
|
||||
continue
|
||||
try:
|
||||
if frappe.get_meta(r.doctype).image_field:
|
||||
doc = frappe.get_doc(r.doctype, r.name)
|
||||
r.image = doc.get(doc.meta.image_field)
|
||||
except:
|
||||
pass
|
||||
|
||||
return results
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue