0

When I add multiple items under (New Purchase Invoice) as shown below, it gives me the only two items I created so far in order to assign them to the supplier selected.

Desk ScreenShot

I need to add two more rows in this pop-up (price & quantity) for each item in the list.

Michael M.
  • 10,486
  • 9
  • 18
  • 34

1 Answers1

0

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.

gavin
  • 793
  • 1
  • 7
  • 19