Skip to content

Commit

Permalink
fix(address_query): show search fields in description if set
Browse files Browse the repository at this point in the history
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
(cherry picked from commit 1c6ba0c)
  • Loading branch information
akhilnarang authored and mergify[bot] committed May 31, 2024
1 parent af1a47d commit 4db0b53
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion frappe/contacts/doctype/address/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,15 @@ def address_query(doctype, txt, searchfield, start, page_len, filters):
else:
title = "`tabAddress`.city"

# Get additional search fields
if searchfields:
extra_query_fields = ",".join([f"`tabAddress`.{field}" for field in searchfields])
else:
extra_query_fields = "`tabAddress`.country"

return frappe.db.sql(
"""select
`tabAddress`.name, {title}, `tabAddress`.country
`tabAddress`.name, {title}, {extra_query_fields}
from
`tabAddress`
join `tabDynamic Link`
Expand All @@ -319,6 +325,7 @@ def address_query(doctype, txt, searchfield, start, page_len, filters):
search_condition=search_condition,
condition=condition or "",
title=title,
extra_query_fields=extra_query_fields,
),
{
"txt": "%" + txt + "%",
Expand Down

0 comments on commit 4db0b53

Please sign in to comment.