mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-18 09:05:00 +00:00
added add_role method in profile
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user