fixes in test runner and add role for profile

This commit is contained in:
Anand Doshi 2013-02-13 19:57:58 +05:30
parent 5070224079
commit 798c6b4fdb
3 changed files with 5 additions and 3 deletions

View File

@ -76,7 +76,7 @@ class DocType:
# add employee role if missing
if not "Employee" in webnotes.conn.sql_list("""select role from tabUserRole
where parent=%s""", self.doc.user_id):
from core.doctype.profile.profile import add_role
from webnotes.profile import add_role
add_role(self.doc.user_id, "HR User")
profile_wrapper = webnotes.model_wrapper("Profile", self.doc.user_id)

View File

@ -78,7 +78,9 @@ class DocType:
if block_date > from_date and block_date < to_date:
webnotes.msgprint(_("You cannot apply for a leave on the following date because it is blocked")
+ ": " + formatdate(d.block_date) + _(" Reason: ") + d.reason)
raise LeaveDayBlockedError
if self.doc.docstatus == 1:
# throw exception only when submitting
raise LeaveDayBlockedError
def is_user_in_allow_list(self, block_list):
return webnotes.session.user in webnotes.conn.sql_list("""select allow_user

View File

@ -20,7 +20,7 @@ class TestLeaveApplication(unittest.TestCase):
webnotes.session.user = "test1@erpnext.com"
from core.doctype.profile.profile import add_role
from webnotes.profile import add_role
add_role("test1@erpnext.com", "HR User")
self.assertTrue(application.insert())