Fixed validation message for disabled employee

This commit is contained in:
Neil Trini Lasrado 2016-03-31 16:52:32 +05:30 committed by Anand Doshi
parent 1dd6329e5b
commit cb6430575b
2 changed files with 965 additions and 965 deletions

File diff suppressed because it is too large Load Diff

View File

@ -133,11 +133,11 @@ class Employee(Document):
def validate_for_enabled_user_id(self):
if not self.status == 'Active':
return
enabled = frappe.db.sql("""select name from `tabUser` where
name=%s and enabled=1""", self.user_id)
if not enabled:
throw(_("User {0} is disabled").format(
self.user_id), EmployeeUserDisabledError)
enabled = frappe.db.get_value("User", self.user_id, "enabled")
if enabled is None:
frappe.throw(_("User {0} does not exist").format(self.user_id))
if enabled == 0:
frappe.throw(_("User {0} is disabled").format(self.user_id), EmployeeUserDisabledError)
def validate_duplicate_user_id(self):
employee = frappe.db.sql_list("""select name from `tabEmployee` where