fix: Include search fields in Project Link field query (#25505)
* fix: Include search fields in Project Link field query * fix: add project_name to Project search fields
This commit is contained in:
parent
7f79d463f6
commit
062d30146f
@ -292,11 +292,14 @@ def get_project_name(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
cond = """(`tabProject`.customer = %s or
|
cond = """(`tabProject`.customer = %s or
|
||||||
ifnull(`tabProject`.customer,"")="") and""" %(frappe.db.escape(filters.get("customer")))
|
ifnull(`tabProject`.customer,"")="") and""" %(frappe.db.escape(filters.get("customer")))
|
||||||
|
|
||||||
fields = get_fields("Project", ["name"])
|
fields = get_fields("Project", ["name", "project_name"])
|
||||||
|
searchfields = frappe.get_meta("Project").get_search_fields()
|
||||||
|
searchfields = " or ".join([field + " like %(txt)s" for field in searchfields])
|
||||||
|
|
||||||
return frappe.db.sql("""select {fields} from `tabProject`
|
return frappe.db.sql("""select {fields} from `tabProject`
|
||||||
where `tabProject`.status not in ("Completed", "Cancelled")
|
where
|
||||||
and {cond} `tabProject`.name like %(txt)s {match_cond}
|
`tabProject`.status not in ("Completed", "Cancelled")
|
||||||
|
and {cond} {match_cond} {scond}
|
||||||
order by
|
order by
|
||||||
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
|
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
|
||||||
idx desc,
|
idx desc,
|
||||||
@ -304,6 +307,7 @@ def get_project_name(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
limit {start}, {page_len}""".format(
|
limit {start}, {page_len}""".format(
|
||||||
fields=", ".join(['`tabProject`.{0}'.format(f) for f in fields]),
|
fields=", ".join(['`tabProject`.{0}'.format(f) for f in fields]),
|
||||||
cond=cond,
|
cond=cond,
|
||||||
|
scond=searchfields,
|
||||||
match_cond=get_match_cond(doctype),
|
match_cond=get_match_cond(doctype),
|
||||||
start=start,
|
start=start,
|
||||||
page_len=page_len), {
|
page_len=page_len), {
|
||||||
|
@ -458,7 +458,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"max_attachments": 4,
|
"max_attachments": 4,
|
||||||
"modified": "2020-09-02 11:54:01.223620",
|
"modified": "2021-04-28 16:36:11.654632",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Projects",
|
"module": "Projects",
|
||||||
"name": "Project",
|
"name": "Project",
|
||||||
@ -495,11 +495,11 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"quick_entry": 1,
|
"quick_entry": 1,
|
||||||
"search_fields": "customer, status, priority, is_active",
|
"search_fields": "project_name,customer, status, priority, is_active",
|
||||||
"show_name_in_global_search": 1,
|
"show_name_in_global_search": 1,
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"timeline_field": "customer",
|
"timeline_field": "customer",
|
||||||
"title_field": "project_name",
|
"title_field": "project_name",
|
||||||
"track_seen": 1
|
"track_seen": 1
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user