Compensatory Off - leave allocation date range

Hi Is there any way wherein we apply for compensatory off the leave allocation date range is only 3 months.

For example,
If I work on any saturday/sunday I mark my attendance and apply a compensatory off the leave allocated for me is more only 3 months( if I work on 19/02/2022 the leave should be valid from 20/02/2022 till 20/05/2022)

1 Like

Any solutions on this ?

No buddy… but yes you can create a Custom doc (comp off request) which will reduce a leave from custom made leave( Comm off) which the approval of team leader/manager and deletion of the comp off request will gain back a leave in custom made leave ( comp off) .

You have to write a Client (JS) script in order to make this thing work:
For me its down below :

frappe.ui.form.on(‘Leave Allocation’, ‘refresh’,‘validated’, function(frm){
var today = new Date(frappe.datetime.nowdate());
var valid = frappe.datetime.get_day_diff( today, frm.doc.from_date);
{
if (frm.doc.leave_type== ‘Comp Off’)
frm.set_value(frm.doc.from_date,frappe.datetime.add_days(doc.to_date,90));
}});

1 Like