fix(address_query): use title field if set
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
43c8ae0049
commit
b0a7d62a9e
1 changed files with 8 additions and 1 deletions
|
|
@ -288,9 +288,15 @@ def address_query(doctype, txt, searchfield, start, page_len, filters):
|
|||
else:
|
||||
search_condition += f" or `tabAddress`.`{field}` like %(txt)s"
|
||||
|
||||
# Use custom title field if set
|
||||
if meta.show_title_field_in_link and meta.title_field:
|
||||
title = f"`tabAddress`.{meta.title_field}"
|
||||
else:
|
||||
title = "`tabAddress`.city"
|
||||
|
||||
return frappe.db.sql(
|
||||
"""select
|
||||
`tabAddress`.name, `tabAddress`.city, `tabAddress`.country
|
||||
`tabAddress`.name, {title}, `tabAddress`.country
|
||||
from
|
||||
`tabAddress`
|
||||
join `tabDynamic Link`
|
||||
|
|
@ -312,6 +318,7 @@ def address_query(doctype, txt, searchfield, start, page_len, filters):
|
|||
mcond=get_match_cond(doctype),
|
||||
search_condition=search_condition,
|
||||
condition=condition or "",
|
||||
title=title,
|
||||
),
|
||||
{
|
||||
"txt": "%" + txt + "%",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue