Item group based on items filter in sales invoice doctype

Good Day,
item group based on items filter in sales invoice doctype. i want client script

Please check the reference:

Please check the documentation of the Overriding Link Query By Custom Script

above code is not working. when i select the particular item group display only selected item group items only.

Hi @D_Haritha,

You have to apply the logic item group, and again check the reference and documentation.

And lots of examples are in the Forum so search for it

frappe.ui.form.on('Sales Invoice',  {
    refresh: function(frm) {
        frm.set_query("item_code", "items", function (doc, cdt, cdn) {
            var row = locals[cdt][cdn];
            return {
                "filters": {
                  "item_group": row.item_group
                },
            };
        });
    }
});
1 Like

Working fine .Thank you

Good Morning
I have a dought when i select the item group items are not apperaing. later Click the arrow symbol next to the item group and it will come back and the items will be refreshed. what is the problem. please help me the issue

If this script were applied to a custom doctype, it would function properly. However, in this case, we are using the script for the item group within a sales invoice. In the sales invoice, the item group is read-only because it automatically populates when an item is selected. The filter applied to the item is defined either in the sales controller or the common sales module, which explains the observed behavior. Here is the code you requested, provided for your reference.

ok i understand. Thank you.