Merge pull request #2283 from neilLasrado/employee-reports-to
employee cannot report to himself validation added to employee doctype
This commit is contained in:
commit
a5082d6233
@ -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")):
|
||||
|
Loading…
x
Reference in New Issue
Block a user