fix: item query in quality inspection (#54721)

This commit is contained in:
Mihir Kandoi
2026-05-04 21:01:10 +05:30
committed by GitHub
parent d07d7feb3f
commit 0b0f9d046d

View File

@@ -392,10 +392,10 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql( return frappe.db.sql(
f""" f"""
SELECT distinct item_code, item_name SELECT distinct `tab{from_doctype}`.item_code, `tab{from_doctype}`.item_name
FROM `tab{from_doctype}` FROM `tab{from_doctype}`
JOIN `tab{parent_doctype}` ON `tab{parent_doctype}`.name = `tab{from_doctype}`.parent JOIN `tab{parent_doctype}` ON `tab{parent_doctype}`.name = `tab{from_doctype}`.parent
WHERE parent=%(parent)s and `tab{parent_doctype}`.docstatus < 2 and item_code like %(txt)s WHERE `tab{from_doctype}`.parent=%(parent)s and `tab{parent_doctype}`.docstatus < 2 and `tab{from_doctype}`.item_code like %(txt)s
{qi_condition} {cond} {mcond} {qi_condition} {cond} {mcond}
ORDER BY item_code limit {cint(page_len)} offset {cint(start)} ORDER BY item_code limit {cint(page_len)} offset {cint(start)}
""", """,