Try ERPNext Buy Support Partners Foundation

Set multiple values on custom script on a timesheet detail

Hi everyone. I ask myself if there is an easy way to set a specific value into a specific index in the timesheet detail.

Here is the code I try but doesn’t work … :

Thanks for help in advance.

frappe.ui.form.on(‘Timesheet Detail’, {
hours(frm, cdt, cdn) {
console.log(“Field hours trigger”)

//VERSION 1
frappe.model.set_value(‘idx’, 0)
.then(() => {
frappe.model.set_value(cdt, cdn, ‘heure_100’, 20.0)
})
frappe.model.set_value(‘idx’, 1)
.then(() => {
frappe.model.set_value(cdt, cdn, ‘heure_100’, 10.0)
})
//VERSION 2
frappe.model.set_value(cdt, cdn, {‘idx’: 0, ‘heure_100’:20.0})
frappe.model.set_value(cdt, cdn, {‘idx’: 1, ‘heure_100’: 10.0})
},
})
And what I have on my screen :

Always write 10 hours …