employee cannot report to himself validation added to employee doctype
This commit is contained in:
parent
ce89c2f192
commit
9b08062bed
@ -39,6 +39,7 @@ class Employee(Document):
|
|||||||
self.validate_email()
|
self.validate_email()
|
||||||
self.validate_status()
|
self.validate_status()
|
||||||
self.validate_employee_leave_approver()
|
self.validate_employee_leave_approver()
|
||||||
|
self.validate_reports_to()
|
||||||
|
|
||||||
if self.user_id:
|
if self.user_id:
|
||||||
self.validate_for_enabled_user_id()
|
self.validate_for_enabled_user_id()
|
||||||
@ -141,6 +142,10 @@ class Employee(Document):
|
|||||||
self.get("employee_leave_approvers").remove(l)
|
self.get("employee_leave_approvers").remove(l)
|
||||||
msgprint(_("{0} is not a valid Leave Approver. Removing row #{1}.").format(l.leave_approver, l.idx))
|
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):
|
def update_dob_event(self):
|
||||||
if self.status == "Active" and self.date_of_birth \
|
if self.status == "Active" and self.date_of_birth \
|
||||||
and not cint(frappe.db.get_value("HR Settings", None, "stop_birthday_reminders")):
|
and not cint(frappe.db.get_value("HR Settings", None, "stop_birthday_reminders")):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user