Skip to content

Commit

Permalink
Merge pull request #1858 from ruchamahabal/fix-leave-approver
Browse files Browse the repository at this point in the history
fix: don't overwrite leave approver while rendering leave summary dashboard
  • Loading branch information
ruchamahabal authored Jun 7, 2024
2 parents e674f4a + e40ba0b commit 291b82a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 6 additions & 2 deletions hrms/hr/doctype/department_approver/department_approver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import get_link_to_form


class DepartmentApprover(Document):
Expand Down Expand Up @@ -81,10 +82,13 @@ def get_approvers(doctype, txt, searchfield, start, page_len, filters):

if len(approvers) == 0:
error_msg = _("Please set {0} for the Employee: {1}").format(
_(field_name), frappe.bold(employee.employee_name)
frappe.bold(_(field_name)),
get_link_to_form("Employee", filters.get("employee"), employee.employee_name),
)
if department_list:
error_msg += " " + _("or for Department: {0}").format(frappe.bold(employee_department))
error_msg += " " + _("or for the Employee's Department: {0}").format(
get_link_to_form("Department", employee_department)
)
frappe.throw(error_msg, title=_("{0} Missing").format(_(field_name)))

return set(tuple(approver) for approver in approvers)
3 changes: 0 additions & 3 deletions hrms/hr/doctype/leave_application/leave_application.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ frappe.ui.form.on("Leave Application", {
if (!r.exc && r.message["leave_allocation"]) {
leave_details = r.message["leave_allocation"];
}
if (!r.exc && r.message["leave_approver"]) {
frm.set_value("leave_approver", r.message["leave_approver"]);
}
lwps = r.message["lwps"];
},
});
Expand Down

0 comments on commit 291b82a

Please sign in to comment.