Skip to content

Commit

Permalink
fix(global_search): Trigger rebuilding on Custom Field's property cha…
Browse files Browse the repository at this point in the history
…nge (frappe#17706)

(cherry picked from commit 3863d9b)

Co-authored-by: Gavin D'souza <gavin18d@gmail.com>
  • Loading branch information
mergify[bot] and gavindsouza committed Aug 2, 2022
1 parent 6c0992e commit a5d576f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions frappe/custom/doctype/customize_form/customize_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ def add_custom_field(self, df, i):
d.insert()
df.fieldname = d.fieldname

if df.get("in_global_search"):
self.flags.rebuild_doctype_for_global_search = True

def update_in_custom_field(self, df, i):
meta = frappe.get_meta(self.doc_type)
meta_df = meta.get("fields", {"fieldname": df.fieldname})
Expand All @@ -387,6 +390,8 @@ def update_in_custom_field(self, df, i):
if df.get(prop) != custom_field.get(prop):
if prop == "fieldtype":
self.validate_fieldtype_change(df, meta_df[0].get(prop), df.get(prop))
if prop == "in_global_search":
self.flags.rebuild_doctype_for_global_search = True

custom_field.set(prop, df.get(prop))
changed = True
Expand Down
3 changes: 0 additions & 3 deletions frappe/utils/global_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ def rebuild_for_doctype(doctype):
if frappe.local.conf.get("disable_global_search"):
return

if frappe.local.conf.get("disable_global_search"):
return

def _get_filters():
filters = frappe._dict({"docstatus": ["!=", 2]})
if meta.has_field("enabled"):
Expand Down

0 comments on commit a5d576f

Please sign in to comment.