From ead858b4deddac9e900957c38b36f7e5830ea28d Mon Sep 17 00:00:00 2001 From: Jamsheer Date: Mon, 14 May 2018 18:08:31 +0530 Subject: [PATCH] Compensatory Leave Request - fix --- .../compensatory_leave_request.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.py b/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.py index 414066838a..2ebe41a0fb 100644 --- a/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.py +++ b/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.py @@ -23,9 +23,8 @@ class CompensatoryLeaveRequest(Document): date_difference = date_diff(self.work_end_date, self.work_from_date) + 1 leave_period = get_leave_period(self.work_from_date, self.work_end_date, company) if leave_period: - leave_allocation_name = self.exists_allocation_for_period(leave_period) - if leave_allocation_name: - leave_allocation = frappe.get_doc("Leave Allocation", leave_allocation_name) + leave_allocation = self.exists_allocation_for_period(leave_period) + if leave_allocation: new_leaves_allocated = leave_allocation.new_leaves_allocated leave_allocation.new_leaves_allocated += date_difference leave_allocation.submit() @@ -51,7 +50,7 @@ class CompensatoryLeaveRequest(Document): }, as_dict=1) if leave_allocation: - return leave_allocation[0].name + return frappe.get_doc("Leave Allocation", leave_allocation[0].name) else: False