employee cannot report to himself validation added to employee doctype

This commit is contained in:
Neil Trini Lasrado 2014-10-09 17:26:17 +05:30
parent ce89c2f192
commit 9b08062bed

View File

@ -39,6 +39,7 @@ class Employee(Document):
self.validate_email()
self.validate_status()
self.validate_employee_leave_approver()
self.validate_reports_to()
if self.user_id:
self.validate_for_enabled_user_id()
@ -141,6 +142,10 @@ class Employee(Document):
self.get("employee_leave_approvers").remove(l)
msgprint(_("{0} is not a valid Leave Approver. Removing row #{1}.").format(l.leave_approver, l.idx))
def validate_reports_to(self):
if self.reports_to == self.name:
throw(_("Employee cannot report to himself."))
def update_dob_event(self):
if self.status == "Active" and self.date_of_birth \
and not cint(frappe.db.get_value("HR Settings", None, "stop_birthday_reminders")):