From ec65af5f38bc860701fc8a15f67212cbb4b357d2 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Thu, 7 Apr 2022 10:07:39 +0530 Subject: [PATCH] fix: show allocation history for earned leaves allocated via scheduler --- erpnext/hr/utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py index fd69a9b4f1..40ab8053c9 100644 --- a/erpnext/hr/utils.py +++ b/erpnext/hr/utils.py @@ -353,6 +353,17 @@ def update_previous_leave_allocation( allocation.db_set("total_leaves_allocated", new_allocation, update_modified=False) create_additional_leave_ledger_entry(allocation, earned_leaves, today_date) + if e_leave_type.based_on_date_of_joining: + text = _("allocated {0} leave(s) via scheduler on {1} based on the date of joining").format( + frappe.bold(earned_leaves), frappe.bold(formatdate(today_date)) + ) + else: + text = _("allocated {0} leave(s) via scheduler on {1}").format( + frappe.bold(earned_leaves), frappe.bold(formatdate(today_date)) + ) + + allocation.add_comment(comment_type="Info", text=text) + def get_monthly_earned_leave(annual_leaves, frequency, rounding): earned_leaves = 0.0