added add_role method in profile
This commit is contained in:
parent
eb92b52817
commit
c45630faf8
@ -78,11 +78,8 @@ class DocType:
|
|||||||
# add employee role if missing
|
# add employee role if missing
|
||||||
if not "Employee" in webnotes.conn.sql_list("""select role from tabUserRole
|
if not "Employee" in webnotes.conn.sql_list("""select role from tabUserRole
|
||||||
where parent=%s""", self.doc.user_id):
|
where parent=%s""", self.doc.user_id):
|
||||||
profile_wrapper.doclist.append({
|
from core.doctype.profile.profile import add_role
|
||||||
"doctype": "UserRole",
|
add_role(self.doc.user_id, "HR User")
|
||||||
"parentfield": "user_roles",
|
|
||||||
"role": "Employee"
|
|
||||||
})
|
|
||||||
|
|
||||||
# copy details like Fullname, DOB and Image to Profile
|
# copy details like Fullname, DOB and Image to Profile
|
||||||
if self.doc.employee_name:
|
if self.doc.employee_name:
|
||||||
|
@ -19,7 +19,10 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
self.assertRaises(LeaveDayBlockedError, application.insert)
|
self.assertRaises(LeaveDayBlockedError, application.insert)
|
||||||
|
|
||||||
webnotes.session.user = "test1@erpnext.com"
|
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())
|
self.assertTrue(application.insert())
|
||||||
|
|
||||||
def test_global_block_list(self):
|
def test_global_block_list(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user