From 632fc6af79e3ddb47c8bfab92b2415f35cb4284e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 9 Sep 2019 13:32:18 +0530 Subject: [PATCH] feat: Added input field for max carry forwarded leaves --- erpnext/hr/doctype/leave_allocation/leave_allocation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.py b/erpnext/hr/doctype/leave_allocation/leave_allocation.py index 73bf01759e..874ae7a1bc 100755 --- a/erpnext/hr/doctype/leave_allocation/leave_allocation.py +++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.py @@ -97,7 +97,7 @@ class LeaveAllocation(Document): self.total_leaves_allocated = flt(self.unused_leaves) + flt(self.new_leaves_allocated) - self.carry_forward_based_on_max_allowed_leaves() + self.limit_carry_forward_based_on_max_allowed_leaves() if self.carry_forward: self.set_carry_forwarded_leaves_in_previous_allocation() @@ -108,7 +108,7 @@ class LeaveAllocation(Document): frappe.throw(_("Total leaves allocated is mandatory for Leave Type {0}") .format(self.leave_type)) - def carry_forward_based_on_max_allowed_leaves(self): + def limit_carry_forward_based_on_max_allowed_leaves(self): max_leaves_allowed = frappe.db.get_value("Leave Type", self.leave_type, "max_leaves_allowed") if max_leaves_allowed and self.total_leaves_allocated > flt(max_leaves_allowed): self.total_leaves_allocated = flt(max_leaves_allowed)