From 22d3a8b41bc926a4a4a909c1a09dfc5e708596ae Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 19 Feb 2013 08:45:22 +0530 Subject: [PATCH] fetch docstatus in leave application for calendar view; fix in leave application test --- hr/doctype/leave_application/leave_application.py | 5 +++-- hr/doctype/leave_application/test_leave_application.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hr/doctype/leave_application/leave_application.py b/hr/doctype/leave_application/leave_application.py index f268704744..4ad1c23bba 100755 --- a/hr/doctype/leave_application/leave_application.py +++ b/hr/doctype/leave_application/leave_application.py @@ -237,7 +237,7 @@ def add_department_leaves(events, start, end, employee, company): department) for d in webnotes.conn.sql("""select name, from_date, to_date, employee_name, half_day, - status, employee + status, employee, docstatus from `tabLeave Application` where (from_date between %s and %s or to_date between %s and %s) and docstatus < 2 @@ -251,7 +251,8 @@ def add_department_leaves(events, start, end, employee, company): "to_date": d.to_date, "status": d.status, "title": _("Leave by") + " " + cstr(d.employee_name) + \ - (d.half_day and _(" (Half Day)") or "") + (d.half_day and _(" (Half Day)") or ""), + "docstatus": d.docstatus }) diff --git a/hr/doctype/leave_application/test_leave_application.py b/hr/doctype/leave_application/test_leave_application.py index 584549add3..ff515b2e48 100644 --- a/hr/doctype/leave_application/test_leave_application.py +++ b/hr/doctype/leave_application/test_leave_application.py @@ -17,6 +17,7 @@ class TestLeaveApplication(unittest.TestCase): application = self.get_application(test_records[1]) application.insert() + application.doc.status = "Approved" self.assertRaises(LeaveDayBlockedError, application.submit) webnotes.session.user = "test1@example.com"