fix: make New Leaves Allocated read-only if policy assignment is linked to the allocation and leave type is earned leave

This commit is contained in:
Rucha Mahabal 2022-04-07 10:06:51 +05:30
parent f8f1c3d8b5
commit 6203ffc8fa

View File

@ -34,6 +34,15 @@ frappe.ui.form.on("Leave Allocation", {
});
}
}
// make new leaves allocated field read only if allocation is created via leave policy assignment
// and leave type is earned leave, since these leaves would be allocated via the scheduler
if (frm.doc.leave_policy_assignment) {
frappe.db.get_value("Leave Type", frm.doc.leave_type, "is_earned_leave", (r) => {
if (r && cint(r.is_earned_leave))
frm.set_df_property("new_leaves_allocated", "read_only", 1);
});
}
},
expire_allocation: function(frm) {