mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 12:19:12 +00:00
fix: validated leave allocation (#20636)
* fix: validated leave allocation * fix: changes requested * Update erpnext/hr/doctype/leave_encashment/leave_encashment.py Co-Authored-By: Nabin Hait <nabinhait@gmail.com> Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
@@ -64,6 +64,9 @@ class LeaveEncashment(Document):
|
|||||||
|
|
||||||
allocation = self.get_leave_allocation()
|
allocation = self.get_leave_allocation()
|
||||||
|
|
||||||
|
if not allocation:
|
||||||
|
frappe.throw(_("No Leaves Allocated to Employee: {0} for Leave Type: {1}").format(self.employee, self.leave_type))
|
||||||
|
|
||||||
self.leave_balance = allocation.total_leaves_allocated - allocation.carry_forwarded_leaves_count\
|
self.leave_balance = allocation.total_leaves_allocated - allocation.carry_forwarded_leaves_count\
|
||||||
- get_unused_leaves(self.employee, self.leave_type, allocation.from_date, self.encashment_date)
|
- get_unused_leaves(self.employee, self.leave_type, allocation.from_date, self.encashment_date)
|
||||||
|
|
||||||
@@ -116,4 +119,4 @@ def create_leave_encashment(leave_allocation):
|
|||||||
leave_type=allocation.leave_type,
|
leave_type=allocation.leave_type,
|
||||||
encashment_date=allocation.to_date
|
encashment_date=allocation.to_date
|
||||||
))
|
))
|
||||||
leave_encashment.insert(ignore_permissions=True)
|
leave_encashment.insert(ignore_permissions=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user