Hello,
I have created a custom field in Sales Order Item table as below:
Custom Field Label: Item Category
Custom Field Data Type: Link
Custom Field Name: item_category
Options: Item Group.
My requirement is, when a particular item group is selected in the custom field item category, only related to that item group the items should display in the Item Code field.
I have tried it using this below script, but it’s not working.
frappe.ui.form.on(“Sales Order Item”, “refresh”, function(frm) {cur_frm.fields_dict[‘items’].grid.get_field(‘item_code’).get_query = function(doc) {
return {
filters: [[
‘Item’, ‘item_group’, ‘=’, doc.item_category
]]
}
};
});
Can anyone please help me with this?
Thanks & Regards,
Sujay