fixes in test runner and add role for profile
This commit is contained in:
parent
5070224079
commit
798c6b4fdb
@ -76,7 +76,7 @@ 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):
|
||||||
from core.doctype.profile.profile import add_role
|
from webnotes.profile import add_role
|
||||||
add_role(self.doc.user_id, "HR User")
|
add_role(self.doc.user_id, "HR User")
|
||||||
|
|
||||||
profile_wrapper = webnotes.model_wrapper("Profile", self.doc.user_id)
|
profile_wrapper = webnotes.model_wrapper("Profile", self.doc.user_id)
|
||||||
|
@ -78,7 +78,9 @@ class DocType:
|
|||||||
if block_date > from_date and block_date < to_date:
|
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")
|
webnotes.msgprint(_("You cannot apply for a leave on the following date because it is blocked")
|
||||||
+ ": " + formatdate(d.block_date) + _(" Reason: ") + d.reason)
|
+ ": " + 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):
|
def is_user_in_allow_list(self, block_list):
|
||||||
return webnotes.session.user in webnotes.conn.sql_list("""select allow_user
|
return webnotes.session.user in webnotes.conn.sql_list("""select allow_user
|
||||||
|
@ -20,7 +20,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
|
|
||||||
webnotes.session.user = "test1@erpnext.com"
|
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")
|
add_role("test1@erpnext.com", "HR User")
|
||||||
|
|
||||||
self.assertTrue(application.insert())
|
self.assertTrue(application.insert())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user