fix: use the item_query for get_data

(cherry picked from commit 169caaf66f)
This commit is contained in:
Karm Soni
2025-07-15 13:23:09 +05:30
committed by Mergify
parent fa01bdc490
commit a7e8f404f7

View File

@@ -43,8 +43,28 @@ frappe.query_reports["Stock Ledger"] = {
label: __("Items"),
fieldtype: "MultiSelectList",
options: "Item",
get_data: function (txt) {
return frappe.db.get_link_options("Item", txt, {});
get_data: async function (txt) {
let { message: data } = await frappe.call({
method: "erpnext.controllers.queries.item_query",
args: {
doctype: "Item",
txt: txt,
searchfield: "name",
start: 0,
page_len: 10,
filters: {},
as_dict: 1,
},
});
data = data.map(({ name, description }) => {
return {
value: name,
description: description,
};
});
return data || [];
},
},
{