Merge pull request #3569 from rmehta/employee-unset-user-id
[fix] remove user permission if user id is unset #3447
This commit is contained in:
commit
526957505f
@ -45,6 +45,10 @@ class Employee(Document):
|
|||||||
if self.user_id:
|
if self.user_id:
|
||||||
self.validate_for_enabled_user_id()
|
self.validate_for_enabled_user_id()
|
||||||
self.validate_duplicate_user_id()
|
self.validate_duplicate_user_id()
|
||||||
|
else:
|
||||||
|
existing_user_id = frappe.db.get_value("Employee", self.name, "user_id")
|
||||||
|
if existing_user_id:
|
||||||
|
frappe.permissions.remove_user_permission("Employee", self.name, existing_user_id)
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
if self.user_id:
|
if self.user_id:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user