The Dialog you see is the LinkSelector
control which is used to select multiple link fields and append them to the child table.
If you open your browser's devtools, you'll notice a search_widget
API call being made with some parameters like the following:
searchfield: name
query: erpnext.controllers.queries.item_query
filters: {"supplier":"_Test Supplier","is_purchase_item":1,"has_variants":0}
doctype: Item
You'll have to override the get_query
call set on item_code
field of purchase_invoice.js
. Here's the snippet that queries the current result:
cur_frm.fields_dict['items'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
return {
query: "erpnext.controllers.queries.item_query",
filters: {'is_purchase_item': 1}
}
}
Understand how the item_query
API works and make the appropriate changes to tailor your requirements from there. From a quick search & review of the code, I have a hunch that you'll have to add more fields under the searchfield
parameter.