I have written a client script in which I am saving the item code or item name in upper case or it is running smoothly but the problem is that when I add the item through quick entry, the code is not working.
My code
frappe.ui.form.on('Item', {
refresh: function(frm) {
// Capitalize item code on form load
if (frm.doc.item_code) {
frm.set_value('item_code', frm.doc.item_code.toUpperCase());
}
// Capitalize item name on form load
if (frm.doc.item_name) {
frm.set_value('item_name', frm.doc.item_name.toUpperCase());
}
},
validate: function(frm) {
// Capitalize item code before saving
if (frm.doc.item_code) {
frm.doc.item_code = frm.doc.item_code.toUpperCase();
frm.refresh_field('item_code');
}
// Capitalize item name before saving
if (frm.doc.item_name) {
frm.doc.item_name = frm.doc.item_name.toUpperCase();
frm.refresh_field('item_name');
}
}
});
Thank You.