feat: Leave Policy Assignment Refactor (#24327)

* feat: Leave Policy Assignment Refactor

* fix: Changes Requested

* fix: sider

* fix: changes requested

* test: fixed

* test: fixed wrong set query

* fix: remove commented code

* fix(style): extra space

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
This commit is contained in:
Anurag Mishra
2021-05-13 13:20:14 +05:30
committed by GitHub
parent 0612300631
commit 0c482fde5f
12 changed files with 53 additions and 128 deletions

View File

@@ -500,13 +500,6 @@ def get_previous_claimed_amount(employee, payroll_period, non_pro_rata=False, co
total_claimed_amount = sum_of_claimed_amount[0].total_amount
return total_claimed_amount
def grant_leaves_automatically():
automatically_allocate_leaves_based_on_leave_policy = frappe.db.get_singles_value("HR Settings", "automatically_allocate_leaves_based_on_leave_policy")
if automatically_allocate_leaves_based_on_leave_policy:
lpa = frappe.db.get_all("Leave Policy Assignment", filters={"effective_from": getdate(), "docstatus": 1, "leaves_allocated":0})
for assignment in lpa:
frappe.get_doc("Leave Policy Assignment", assignment.name).grant_leave_alloc_for_employee()
def share_doc_with_approver(doc, user):
# if approver does not have permissions, share
if not frappe.has_permission(doc=doc, ptype="submit", user=user):