From 3557261313278b64295d5514d5df7f32d146ddfd Mon Sep 17 00:00:00 2001 From: Maxwell Morais Date: Thu, 21 Jul 2016 23:42:59 -0300 Subject: [PATCH] Extend search_fields for customer querie This PR is intended to extend the customer querie adding the meta-info from the doctype using the search fields to extend the customer querie --- erpnext/controllers/queries.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index f53ad531d6..0debe4aced 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -85,6 +85,9 @@ def customer_query(doctype, txt, searchfield, start, page_len, filters): fields = ["name", "customer_group", "territory"] else: fields = ["name", "customer_name", "customer_group", "territory"] + + meta = frappe.get_meta("Customer") + fields = fields + [f for f in meta.get_search_fields() if not f in fields] fields = ", ".join(fields) @@ -364,4 +367,4 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters): match_condition=get_match_cond(doctype)), { 'company': filters.get("company", ""), 'txt': "%%%s%%" % frappe.db.escape(txt) - }) \ No newline at end of file + })