fix: In global search property from customize form is not working (#7261)

This commit is contained in:
rohitwaghchaure 2019-04-11 16:07:09 +05:30 committed by Faris Ansari
parent e8d5872eb7
commit 2f0201e8e1

View file

@ -149,6 +149,7 @@ class CustomizeForm(Document):
return
self.flags.update_db = False
self.flags.rebuild_doctype_for_global_search = False
self.set_property_setters()
self.update_custom_fields()
@ -164,6 +165,10 @@ class CustomizeForm(Document):
frappe.clear_cache(doctype=self.doc_type)
self.fetch_to_customize()
if self.flags.rebuild_doctype_for_global_search:
frappe.enqueue('frappe.utils.global_search.rebuild_for_doctype',
now=True, doctype=self.doc_type)
def set_property_setters(self):
meta = frappe.get_meta(self.doc_type)
# doctype property setters
@ -224,6 +229,10 @@ class CustomizeForm(Document):
frappe.msgprint(_("You can't set 'Translatable' for field {0}").format(df.label))
continue
elif (property == 'in_global_search' and
df.in_global_search != meta_df[0].get("in_global_search")):
self.flags.rebuild_doctype_for_global_search = True
self.make_property_setter(property=property, value=df.get(property),
property_type=docfield_properties[property], fieldname=df.fieldname)