fix(ux): show row index and field label while selecting the Sales Order Item
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 199732b..e858820 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -891,3 +891,31 @@
as_list=1,
)
return terms
+
+
+@frappe.whitelist()
+@frappe.validate_and_sanitize_search_inputs
+def get_filtered_child_rows(doctype, txt, searchfield, start, page_len, filters) -> list:
+ table = frappe.qb.DocType(doctype)
+ query = (
+ frappe.qb.from_(table)
+ .select(
+ table.name,
+ Concat("#", table.idx, ", ", table.item_code),
+ )
+ .orderby(table.idx)
+ .offset(start)
+ .limit(page_len)
+ )
+
+ if filters:
+ for field, value in filters.items():
+ query = query.where(table[field] == value)
+
+ if txt:
+ txt += "%"
+ query = query.where(
+ ((table.idx.like(txt.replace("#", ""))) | (table.item_code.like(txt))) | (table.name.like(txt))
+ )
+
+ return query.run(as_dict=False)
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index be02877..0d36f23 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -225,6 +225,7 @@
in_list_view: 1,
get_query: () => {
return {
+ query: "erpnext.controllers.queries.get_filtered_child_rows",
filters: {
"parenttype": frm.doc.doctype,
"parent": frm.doc.name,