Something strange happening, I had a similar script which is working but the below script that I placed in Employee doctype isnt working.
frappe.ui.form.on('Employee External Work History', { refresh(frm) { set_salary(frm); }, validate: function(frm) { set_salary(frm); }, basic_salary: function(frm) { set_salary(frm); }, fixed_allowance: function(frm) { set_salary(frm); }, last_drawn_commission_incentive: function(frm) { set_salary(frm); } }); var set_salary = function(frm, cdt, cdn) { var salary = 0.0; if(frm.doc.external_work_history) { $.each(frm.doc.external_work_history, function(i, row) { row.salary = row.basic_salary + row.fixed_allowance + row.last_drawn_commission_incentive; }); frappe.model.set_value(cdt, cdn, 'row.salary', row.salary); return; } };
Below is the Customize Form of Employee External Work History