Hi! How do I make a client script returning an error if est trip duration is not equal to est working duration + est rest time + est break time.
I tried this script, but it’s not working:
refresh(frm) {
frappe.ui.form.on('Delivery', 'validate', function(frm) {
if(frm.doc.est_working_duration + frm.doc.est_rest_time + frm.doc.est_break_time != frm.doc.est_travel_duration){
frappe.throw({
title: __('Error'),
indicator: 'red',
message: __('Est Working Duration + Est Rest Time + Est Break Time should be equal to Est Travel Duration')
});
validated = false;
}
});
}
});
How do you compare if duration matches between fields?