Hi, I have written following script for sales invoice but it is somehow not updating cost centers of child table items when there is already a cost center selected. Basically it is not overwriting a previously selected value.
This is the code i am using:
frappe.ui.form.on(‘Task’, {
refresh: function(frm) {
for (var i in frm.doc.items){
frm.doc.items[i].cost_center=frm.doc.cost_center;
}
}
});
Can someone please guide what is the issue?