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:
Nabin Hait 2015-07-06 14:27:22 +05:30
commit 526957505f

View File

@ -45,6 +45,10 @@ class Employee(Document):
if self.user_id:
self.validate_for_enabled_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):
if self.user_id: