fix: Hide Ex-Employees from Employee Tree and minor message UX (#23711)
* fix: Hide Ex-Employees from Employee Tree and minor message UX * fix: translation syntax
This commit is contained in:
parent
4eb87ea8e2
commit
9d94f785e9
@ -181,8 +181,11 @@ class Employee(NestedSet):
|
||||
)
|
||||
if reports_to:
|
||||
link_to_employees = [frappe.utils.get_link_to_form('Employee', employee.name, label=employee.employee_name) for employee in reports_to]
|
||||
throw(_("Employee status cannot be set to 'Left' as following employees are currently reporting to this employee: ")
|
||||
+ ', '.join(link_to_employees), EmployeeLeftValidationError)
|
||||
message = _("The following employees are currently still reporting to {0}:").format(frappe.bold(self.employee_name))
|
||||
message += "<br><br><ul><li>" + "</li><li>".join(link_to_employees)
|
||||
message += "</li></ul><br>"
|
||||
message += _("Please make sure the employees above report to another Active employee.")
|
||||
throw(message, EmployeeLeftValidationError, _("Cannot Relieve Employee"))
|
||||
if not self.relieving_date:
|
||||
throw(_("Please enter relieving date."))
|
||||
|
||||
@ -215,7 +218,7 @@ class Employee(NestedSet):
|
||||
|
||||
def validate_preferred_email(self):
|
||||
if self.prefered_contact_email and not self.get(scrub(self.prefered_contact_email)):
|
||||
frappe.msgprint(_("Please enter " + self.prefered_contact_email))
|
||||
frappe.msgprint(_("Please enter {0}").format(self.prefered_contact_email))
|
||||
|
||||
def validate_onboarding_process(self):
|
||||
employee_onboarding = frappe.get_all("Employee Onboarding",
|
||||
@ -417,9 +420,9 @@ def get_employee_emails(employee_list):
|
||||
@frappe.whitelist()
|
||||
def get_children(doctype, parent=None, company=None, is_root=False, is_tree=False):
|
||||
|
||||
filters = []
|
||||
filters = [['status', '!=', 'Left']]
|
||||
if company and company != 'All Companies':
|
||||
filters = [['company', '=', company]]
|
||||
filters.append(['company', '=', company])
|
||||
|
||||
fields = ['name as value', 'employee_name as title']
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user