Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: toggle self leave approval for employees from HR settings (backport #2486) #2734

Closed
wants to merge 12 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: removed action buttons
(cherry picked from commit bb15010)

# Conflicts:
#	hrms/hr/doctype/leave_application/leave_application.js
  • Loading branch information
asmitahase authored and mergify[bot] committed Jan 30, 2025
commit 55db71086005aef232d0a48fb06afce10e42339b
30 changes: 5 additions & 25 deletions hrms/hr/doctype/leave_application/leave_application.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ frappe.ui.form.on("Leave Application", {
},

refresh: function (frm) {
<<<<<<< HEAD
=======
hrms.leave_utils.add_view_ledger_button(frm);
>>>>>>> bb15010d (fix: removed action buttons)
if (frm.is_new()) {
frm.trigger("calculate_total_days");
}
Expand Down Expand Up @@ -271,9 +275,7 @@ frappe.ui.form.on("Leave Application", {
!frm.is_dirty() &&
!frappe.model.has_workflow(frm.doctype)
) {
if (current_employee != frm.doc.employee) {
frm.trigger("show_grouped_buttons");
} else if (self_approval_not_allowed) {
if (self_approval_not_allowed && current_employee == frm.doc.employee) {
frm.set_df_property("status", "read_only", 1);
frm.trigger("show_save_button");
}
Expand All @@ -285,28 +287,6 @@ frappe.ui.form.on("Leave Application", {
});
$(".form-message").prop("hidden", true);
},

show_grouped_buttons: function (frm) {
frm.disable_save();
$(".form-message").prop("hidden", true);
frm.add_custom_button(
__("Approve"),
() => {
frm.set_value("status", "Approved");
frm.save("Submit");
},
__("Actions"),
);
frm.add_custom_button(
__("Reject"),
() => {
frm.set_value("status", "Rejected");
frm.save("Submit");
},
__("Actions"),
);
frm.page.set_inner_btn_group_as_primary(__("Actions"));
},
});

frappe.tour["Leave Application"] = [
Expand Down
Loading