frappe.ui.form.on('Sales Invoice', {
custom_sales_type: function(frm) {
frm.trigger('update_naming_series');
},
update_naming_series: function(frm) {
switch (frm.doc.custom_sales_type) {
case "B2B PRODUCT INDIA":
frm.set_value('naming_series', "SI24B25/I./");
break;
case "B2C PRODUCT INDIA":
frm.set_value('naming_series', "SI24C25/I./");
break;
case "B2B CONSUMABLES INDIA":
frm.set_value('naming_series', "SI24B25/C./");
break;
case "B2C CONSUMABLES INDIA":
frm.set_value('naming_series', "SI24C25/C./");
break;
case "B2B SPARES INDIA":
frm.set_value('naming_series', "SI24B25/S./");
break;
case "B2C SPARES INDIA":
frm.set_value('naming_series', "SI24C25/S./");
break;
case "B2B AMC INDIA":
frm.set_value('naming_series', "SI24B25/A./");
break;
case "B2C AMC INDIA":
frm.set_value('naming_series', "SI24C25/A./");
break;
case "SALES INTERNATIONAL":
frm.set_value('naming_series', "SI24I25/F./");
break;
default:
frm.set_value('naming_series', "");
}
frm.refresh_field('custom_sales_type');
}
});
Here this is not working when i import or when i use get items from on sales invoice it only work when i manualy changes the sales type