fix: invalid dynamic link filter for address doctype (#53849)

This commit is contained in:
Mihir Kandoi
2026-03-27 17:53:58 +05:30
committed by GitHub
parent 6008fa710d
commit 935eea6463
2 changed files with 27 additions and 4 deletions

View File

@@ -1036,3 +1036,26 @@ def get_item_uom_query(doctype: str, txt: str, searchfield: str, start: int, pag
limit_page_length=page_len,
as_list=1,
)
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_warehouse_address(doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: dict):
table = frappe.qb.DocType(doctype)
child_table = frappe.qb.DocType("Dynamic Link")
query = (
frappe.qb.from_(table)
.inner_join(child_table)
.on((table.name == child_table.parent) & (child_table.parenttype == doctype))
.select(table.name)
.where(
(child_table.link_name == filters.get("warehouse"))
& (table.disabled == 0)
& (child_table.link_doctype == "Warehouse")
& (table.name.like(f"%{txt}%"))
)
.offset(start)
.limit(page_len)
)
return query.run(as_list=1)