Hello,
I have created several options in the naming_series of the Item DocType, which I want to select depending on the item_group selected. However, it doesn’t seem to work.
Can anyone help and tell me where I’m going wrong?
Thanks
refresh: function(frm) {
frm.fields_dict['Item Group'].on("change", function() {
var item_group = frm.doc.item_group;
if (item_group === "Other") {
frm.set_value("Naming Series", "GIN-.#####.");
} else if (item_group === "CAT-1 Raw Materials" || item_group === "CAT-2 Consumables") {
frm.set_value('Naming Series', ".{custom_pn_class}.-.{custom_pn_value_1}.-.{custom_pn_value_2}.-.###.");
} else if (item_group === "CAT-3 Sub-Assemblies" || item_group === "CAT-4 Semi-Finished Goods") {
frm.set_value('Naming Series', ".{custom_pn_product_line}.-.{custom_pn_class}.-.{custom_pn_value_1}.###.");
} else if (item_group === "CAT-5 Finished Products") {
frm.set_value('Naming Series', ".{custom_pn_product_line}.-.{custom_pn_class}.-.{custom_pn_value_1}.-.{custom_pn_region_code}.-.{custom_pn_language_code}.-####.");
}
});
}
});