fetch docstatus in leave application for calendar view; fix in leave application test

This commit is contained in:
Anand Doshi 2013-02-19 08:45:22 +05:30
parent 6ad06f3210
commit 22d3a8b41b
2 changed files with 4 additions and 2 deletions

View File

@ -237,7 +237,7 @@ def add_department_leaves(events, start, end, employee, company):
department) department)
for d in webnotes.conn.sql("""select name, from_date, to_date, employee_name, half_day, 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 `tabLeave Application` where
(from_date between %s and %s or to_date between %s and %s) (from_date between %s and %s or to_date between %s and %s)
and docstatus < 2 and docstatus < 2
@ -251,7 +251,8 @@ def add_department_leaves(events, start, end, employee, company):
"to_date": d.to_date, "to_date": d.to_date,
"status": d.status, "status": d.status,
"title": _("Leave by") + " " + cstr(d.employee_name) + \ "title": _("Leave by") + " " + cstr(d.employee_name) + \
(d.half_day and _(" (Half Day)") or "") (d.half_day and _(" (Half Day)") or ""),
"docstatus": d.docstatus
}) })

View File

@ -17,6 +17,7 @@ class TestLeaveApplication(unittest.TestCase):
application = self.get_application(test_records[1]) application = self.get_application(test_records[1])
application.insert() application.insert()
application.doc.status = "Approved"
self.assertRaises(LeaveDayBlockedError, application.submit) self.assertRaises(LeaveDayBlockedError, application.submit)
webnotes.session.user = "test1@example.com" webnotes.session.user = "test1@example.com"