this employee has 3 leaves available but this employee take 5 days leave and 5 days leaves appprove now 2 leaves show in minus
but can we make it as if Total Leaves Day is greater than available leaves then leave application cannot save and approve
@Rahul7218 Write the validate function to check if leave is greater than total leave then throw error message
1 Like
can you please provide code
@Rahul7218 Please check this code
Code :
frappe.ui.form.on('Leave Application', {
validate(frm) {
if (frm.doc.total_leave_days > frm.doc.leave_balance){
frappe.throw("Selected Leave is more than allocated leave")
}
}
})
1 Like
Yes Marked