added add_role method in profile

This commit is contained in:
Anand Doshi 2013-02-13 18:35:33 +05:30
parent eb92b52817
commit c45630faf8
2 changed files with 6 additions and 6 deletions

View File

@ -78,11 +78,8 @@ 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):
profile_wrapper.doclist.append({
"doctype": "UserRole",
"parentfield": "user_roles",
"role": "Employee"
})
from core.doctype.profile.profile import add_role
add_role(self.doc.user_id, "HR User")
# copy details like Fullname, DOB and Image to Profile
if self.doc.employee_name:

View File

@ -19,7 +19,10 @@ class TestLeaveApplication(unittest.TestCase):
self.assertRaises(LeaveDayBlockedError, application.insert)
webnotes.session.user = "test1@erpnext.com"
webnotes.get_obj("Profile", "test1@erpnext.com").add_role("HR User")
from core.doctype.profile.profile import add_role
add_role("test1@erpnext.com", "HR User")
self.assertTrue(application.insert())
def test_global_block_list(self):