Subtract 2 custom fields. Custom Script not working

Hi. I’m quite new at working with ERPNext and I’m trying to subtract two custom fields I have created with a Custom Script. Both fields are located in “Projects” and they are “WorkHours” and “HoursDone”.

I need to calculate the RemainingHours of the project. I tried this:

frappe.ui.form.on (“Project”, “RemainingHours”, function (frm) {
frappe.model.set_value (“RemainingHouse”, (frm.doc.WorkHours-frm.doc.HoursDone));


frappe.model.set_value ("RemainingHouse", flt(frm.doc.WorkHours)-flt(frm.doc.HoursDone));

It still doesn’t work. Is there anywhere a sort of documentation to understand better the language used?

Try to log on console:


console.log (flt(frm.doc.WorkHours)-flt(frm.doc.HoursDone)));

and check result on chrome dev console