From d15b1fe48c7e588486b858f3caedd5810d245c98 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Mon, 8 Jul 2024 20:05:26 +0530 Subject: [PATCH 1/7] fix: employee attendance tool datatable width --- .../employee_attendance_tool/employee_attendance_tool.js | 2 +- .../employee_attendance_tool.json | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hrms/hr/doctype/employee_attendance_tool/employee_attendance_tool.js b/hrms/hr/doctype/employee_attendance_tool/employee_attendance_tool.js index bca5686c8f..ff6420031f 100644 --- a/hrms/hr/doctype/employee_attendance_tool/employee_attendance_tool.js +++ b/hrms/hr/doctype/employee_attendance_tool/employee_attendance_tool.js @@ -118,7 +118,7 @@ frappe.ui.form.on("Employee Attendance Tool", { data: data, dynamicRowHeight: true, inlineFilters: true, - layout: "fixed", + layout: "fluid", cellHeight: 35, noDataMessage: __("No Data"), disableReorderColumn: true, diff --git a/hrms/hr/doctype/employee_attendance_tool/employee_attendance_tool.json b/hrms/hr/doctype/employee_attendance_tool/employee_attendance_tool.json index d955912fd4..dfcb0543c2 100644 --- a/hrms/hr/doctype/employee_attendance_tool/employee_attendance_tool.json +++ b/hrms/hr/doctype/employee_attendance_tool/employee_attendance_tool.json @@ -21,7 +21,8 @@ "column_break_kecn", "shift", "marked_attendance_section", - "marked_attendance_html" + "marked_attendance_html", + "column_break_khjs" ], "fields": [ { @@ -124,12 +125,16 @@ "fieldtype": "Link", "label": "Shift", "options": "Shift Type" + }, + { + "fieldname": "column_break_khjs", + "fieldtype": "Column Break" } ], "hide_toolbar": 1, "issingle": 1, "links": [], - "modified": "2024-03-27 13:09:37.447557", + "modified": "2024-07-08 20:02:36.408240", "modified_by": "Administrator", "module": "HR", "name": "Employee Attendance Tool", From 92b4fa12dd1e9d80a6abd5649fb5fa8e462b416d Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Mon, 8 Jul 2024 20:08:48 +0530 Subject: [PATCH 2/7] fix: fetch applicant's designation in job offer --- hrms/hr/doctype/job_offer/job_offer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hrms/hr/doctype/job_offer/job_offer.json b/hrms/hr/doctype/job_offer/job_offer.json index e3d0fb3a93..85c420ac81 100644 --- a/hrms/hr/doctype/job_offer/job_offer.json +++ b/hrms/hr/doctype/job_offer/job_offer.json @@ -76,6 +76,8 @@ "reqd": 1 }, { + "fetch_from": "job_applicant.designation", + "fetch_if_empty": 1, "fieldname": "designation", "fieldtype": "Link", "in_list_view": 1, @@ -167,7 +169,7 @@ ], "is_submittable": 1, "links": [], - "modified": "2024-03-27 13:09:57.574961", + "modified": "2024-07-08 15:53:30.761581", "modified_by": "Administrator", "module": "HR", "name": "Job Offer", From 7dec80b8a4979a48742ac452b8667fd68354ac6f Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Mon, 8 Jul 2024 22:38:29 +0530 Subject: [PATCH 3/7] fix(Leave Control Panel): broken confirmation before allocation flow --- .../leave_control_panel.js | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/hrms/hr/doctype/leave_control_panel/leave_control_panel.js b/hrms/hr/doctype/leave_control_panel/leave_control_panel.js index 3fc8ffc85c..618f552711 100644 --- a/hrms/hr/doctype/leave_control_panel/leave_control_panel.js +++ b/hrms/hr/doctype/leave_control_panel/leave_control_panel.js @@ -185,30 +185,11 @@ frappe.ui.form.on("Leave Control Panel", { if (is_checked) selected_employees.push(frm.employees_datatable.datamanager.data[idx].employee); }); - frm.call({ - method: "allocate_leave", - doc: frm.doc, - args: { - employees: selected_employees, - }, - freeze: true, - freeze_message: __("Allocating Leave"), - }).then((r) => { - // don't refresh on complete failure - if (r.message.failed && !r.message.success) return; - frm.refresh(); - }); hrms.validate_mandatory_fields(frm, selected_employees); - frm.events.show_confirm_dialog(frm, selected_employees); - }, - show_confirm_dialog(frm, selected_employees) { - frappe.confirm( - __("Allocate Leave to {0} employee(s)?", [selected_employees.length]), - () => { - frm.events.bulk_allocate_leave(frm, selected_employees); - }, + frappe.confirm(__("Allocate Leave to {0} employee(s)?", [selected_employees.length]), () => + frm.events.bulk_allocate_leave(frm, selected_employees), ); }, @@ -221,6 +202,10 @@ frappe.ui.form.on("Leave Control Panel", { }, freeze: true, freeze_message: __("Allocating Leave"), + }).then((r) => { + // don't refresh on complete failure + if (r.message.failed && !r.message.success) return; + frm.refresh(); }); }, }); From 1c8a96b4a55865f56985f3cc77f1fbc86a346c80 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Mon, 15 Jul 2024 17:01:50 +0530 Subject: [PATCH 4/7] fix(Bulk Salary Assignments): fetch company from structure & fix casing in error message --- .../bulk_salary_structure_assignment.js | 2 +- .../bulk_salary_structure_assignment.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hrms/payroll/doctype/bulk_salary_structure_assignment/bulk_salary_structure_assignment.js b/hrms/payroll/doctype/bulk_salary_structure_assignment/bulk_salary_structure_assignment.js index a786e34cee..f07fde30e5 100644 --- a/hrms/payroll/doctype/bulk_salary_structure_assignment/bulk_salary_structure_assignment.js +++ b/hrms/payroll/doctype/bulk_salary_structure_assignment/bulk_salary_structure_assignment.js @@ -197,7 +197,7 @@ frappe.ui.form.on("Bulk Salary Structure Assignment", { __(d), function () { const dialog = new frappe.ui.Dialog({ - title: __("Set {0} for Selected Employees", [__(d)]), + title: __("Set {0} for selected employees", [__(d)]), fields: [ { label: __(d), diff --git a/hrms/payroll/doctype/bulk_salary_structure_assignment/bulk_salary_structure_assignment.json b/hrms/payroll/doctype/bulk_salary_structure_assignment/bulk_salary_structure_assignment.json index 20fc55b362..4b3e41ae49 100644 --- a/hrms/payroll/doctype/bulk_salary_structure_assignment/bulk_salary_structure_assignment.json +++ b/hrms/payroll/doctype/bulk_salary_structure_assignment/bulk_salary_structure_assignment.json @@ -108,10 +108,12 @@ "label": "Employees HTML" }, { + "fetch_from": "salary_structure.company", "fieldname": "company", "fieldtype": "Link", "label": "Company", "options": "Company", + "read_only": 1, "reqd": 1 }, { @@ -145,7 +147,7 @@ "hide_toolbar": 1, "issingle": 1, "links": [], - "modified": "2024-03-27 13:06:42.973162", + "modified": "2024-07-09 19:33:40.135057", "modified_by": "Administrator", "module": "Payroll", "name": "Bulk Salary Structure Assignment", From 3b30c751f0b3508b170a2691d0259156e3ae2920 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Mon, 15 Jul 2024 17:05:32 +0530 Subject: [PATCH 5/7] fix: error messages in payroll --- hrms/payroll/doctype/payroll_entry/payroll_entry.py | 8 ++++++-- hrms/payroll/doctype/salary_slip/salary_slip.py | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hrms/payroll/doctype/payroll_entry/payroll_entry.py b/hrms/payroll/doctype/payroll_entry/payroll_entry.py index 963c661ba5..997e9224c6 100644 --- a/hrms/payroll/doctype/payroll_entry/payroll_entry.py +++ b/hrms/payroll/doctype/payroll_entry/payroll_entry.py @@ -1421,13 +1421,17 @@ def show_payroll_submission_status(submitted, unsubmitted, payroll_entry): frappe.msgprint( _("Salary Slips submitted for period from {0} to {1}").format( payroll_entry.start_date, payroll_entry.end_date - ) + ), + title=_("Success"), + indicator="green", ) elif unsubmitted: frappe.msgprint( _("Could not submit some Salary Slips: {}").format( ", ".join(get_link_to_form("Salary Slip", entry) for entry in unsubmitted) - ) + ), + title=_("Failure"), + indicator="red", ) diff --git a/hrms/payroll/doctype/salary_slip/salary_slip.py b/hrms/payroll/doctype/salary_slip/salary_slip.py index 98fb01ecb0..06d33058b4 100644 --- a/hrms/payroll/doctype/salary_slip/salary_slip.py +++ b/hrms/payroll/doctype/salary_slip/salary_slip.py @@ -560,7 +560,11 @@ def get_payment_days(self, include_holidays_in_total_working_days): if self.relieving_date: employee_status = frappe.db.get_value("Employee", self.employee, "status") if self.relieving_date < getdate(self.start_date) and employee_status != "Left": - frappe.throw(_("Employee relieved on {0} must be set as 'Left'").format(self.relieving_date)) + frappe.throw( + _("Employee {0} relieved on {1} must be set as 'Left'").format( + self.employee, self.relieving_date + ) + ) payment_days = date_diff(self.actual_end_date, self.actual_start_date) + 1 From 91e056af6bec096e90d6d32bad884ce617114d0f Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Mon, 15 Jul 2024 17:25:19 +0530 Subject: [PATCH 6/7] refactor: avoid 2 primary actions in Interview form --- hrms/hr/doctype/interview/interview.js | 98 ++++++++++++++------------ 1 file changed, 51 insertions(+), 47 deletions(-) diff --git a/hrms/hr/doctype/interview/interview.js b/hrms/hr/doctype/interview/interview.js index b65758a608..7586e7fe68 100644 --- a/hrms/hr/doctype/interview/interview.js +++ b/hrms/hr/doctype/interview/interview.js @@ -23,60 +23,64 @@ frappe.ui.form.on("Interview", { ]); }, - add_custom_buttons: function (frm) { - if (frm.doc.docstatus != 2 && !frm.doc.__islocal) { - if (frm.doc.status === "Pending") { - frm.add_custom_button( - __("Reschedule Interview"), - function () { - frm.events.show_reschedule_dialog(frm); - frm.refresh(); - }, - __("Actions"), - ); - } + add_custom_buttons: async function (frm) { + if (frm.doc.docstatus === 2 || frm.doc.__islocal) return; - const allow_feedback_submission = frm.doc.interview_details.some( - (interviewer) => interviewer.interviewer === frappe.session.user, + if (frm.doc.status === "Pending") { + frm.add_custom_button( + __("Reschedule Interview"), + function () { + frm.events.show_reschedule_dialog(frm); + frm.refresh(); + }, + __("Actions"), ); + } - frappe.db.get_value( - "Interview Feedback", - { - interviewer: frappe.session.user, - interview: frm.doc.name, - docstatus: 1, - }, - "name", - (r) => { - if (Object.keys(r).length === 0) { - const button = frm.add_custom_button(__("Submit Feedback"), function () { - frappe.call({ - method: "hrms.hr.doctype.interview.interview.get_expected_skill_set", - args: { - interview_round: frm.doc.interview_round, - }, - callback: function (r) { - frm.events.show_feedback_dialog(frm, r.message); - frm.refresh(); - }, - }); - }); + const has_submitted_feedback = await frappe.db.get_value( + "Interview Feedback", + { + interviewer: frappe.session.user, + interview: frm.doc.name, + docstatus: ("!=", 2), + }, + "name", + )?.message?.name; - if (allow_feedback_submission) { - button.addClass("btn-primary"); - } else { - button - .prop("disabled", true) - .attr("title", __("Only interviewers can submit feedback")) - .tooltip({ delay: { show: 600, hide: 100 }, trigger: "hover" }); - } - } - }, - ); + if (has_submitted_feedback) return; + + const allow_feedback_submission = frm.doc.interview_details.some( + (interviewer) => interviewer.interviewer === frappe.session.user, + ); + + if (allow_feedback_submission) { + frm.page.set_primary_action(__("Submit Feedback"), () => { + frm.trigger("submit_feedback"); + }); + } else { + const button = frm.add_custom_button(__("Submit Feedback"), () => { + frm.trigger("submit_feedback"); + }); + button + .prop("disabled", true) + .attr("title", __("Only interviewers can submit feedback")) + .tooltip({ delay: { show: 600, hide: 100 }, trigger: "hover" }); } }, + submit_feedback: function (frm) { + frappe.call({ + method: "hrms.hr.doctype.interview.interview.get_expected_skill_set", + args: { + interview_round: frm.doc.interview_round, + }, + callback: function (r) { + frm.events.show_feedback_dialog(frm, r.message); + frm.refresh(); + }, + }); + }, + show_reschedule_dialog: function (frm) { let d = new frappe.ui.Dialog({ title: "Reschedule Interview", From 891f0b9b1a90c2097d3529fcca53757b2a58873c Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Mon, 15 Jul 2024 17:42:45 +0530 Subject: [PATCH 7/7] fix: links & formatting in messages --- hrms/hr/doctype/leave_control_panel/leave_control_panel.js | 5 +++-- hrms/payroll/doctype/salary_slip/salary_slip.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hrms/hr/doctype/leave_control_panel/leave_control_panel.js b/hrms/hr/doctype/leave_control_panel/leave_control_panel.js index 618f552711..074806b8b8 100644 --- a/hrms/hr/doctype/leave_control_panel/leave_control_panel.js +++ b/hrms/hr/doctype/leave_control_panel/leave_control_panel.js @@ -188,8 +188,9 @@ frappe.ui.form.on("Leave Control Panel", { hrms.validate_mandatory_fields(frm, selected_employees); - frappe.confirm(__("Allocate Leave to {0} employee(s)?", [selected_employees.length]), () => - frm.events.bulk_allocate_leave(frm, selected_employees), + frappe.confirm( + __("Allocate leaves to {0} employee(s)?", [selected_employees.length]), + () => frm.events.bulk_allocate_leave(frm, selected_employees), ); }, diff --git a/hrms/payroll/doctype/salary_slip/salary_slip.py b/hrms/payroll/doctype/salary_slip/salary_slip.py index 06d33058b4..2a96e99a65 100644 --- a/hrms/payroll/doctype/salary_slip/salary_slip.py +++ b/hrms/payroll/doctype/salary_slip/salary_slip.py @@ -562,7 +562,7 @@ def get_payment_days(self, include_holidays_in_total_working_days): if self.relieving_date < getdate(self.start_date) and employee_status != "Left": frappe.throw( _("Employee {0} relieved on {1} must be set as 'Left'").format( - self.employee, self.relieving_date + get_link_to_form("Employee", self.employee), formatdate(self.relieving_date) ) )