From 360c4be8c63b3f418570165f5bbbf9ff9dfe3fee Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 12:02:22 +0530 Subject: [PATCH 1/4] feat: pass doctype as context when translating label (backport #1439) (#1440) (cherry picked from commit ce66742c478d9ecbe3e92dc5746abd243ba1339d) Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com> --- hrms/hr/employee_property_update.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hrms/hr/employee_property_update.js b/hrms/hr/employee_property_update.js index 5f87ae2d8e..887b9065c4 100644 --- a/hrms/hr/employee_property_update.js +++ b/hrms/hr/employee_property_update.js @@ -57,7 +57,7 @@ frappe.ui.form.on(cur_frm.doctype, { frappe.model.with_doctype("Employee", () => { const field_label_map = {}; frappe.get_meta("Employee").fields.forEach(d => { - field_label_map[d.fieldname] = __(d.label) + ` (${d.fieldname})`; + field_label_map[d.fieldname] = __(d.label, null, d.parent) + ` (${d.fieldname})`; if ( !in_list(exclude_field_types, d.fieldtype) && !in_list(exclude_fields, d.fieldname) From 1fc5b9e1d3a8b5424651a19587d24232e2f565b2 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 12:56:39 +0530 Subject: [PATCH 2/4] fix(Leave Application): Corrected rendering of Leave Application email template when HTML format is used (backport #1435) (#1442) When the Email Notification template for Leave Application uses HTML and the use HTML checkbox is selected, the correct property for referencing the template response is response_ rather than response. The same has been corrected. (cherry picked from commit b28e658482424ed382e232500d3bc68bffa6663d) Co-authored-by: zaheer-srushty <123548488+zaheer-srushty@users.noreply.github.com> --- hrms/hr/doctype/leave_application/leave_application.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hrms/hr/doctype/leave_application/leave_application.py b/hrms/hr/doctype/leave_application/leave_application.py index ab617785d1..f430c3e515 100755 --- a/hrms/hr/doctype/leave_application/leave_application.py +++ b/hrms/hr/doctype/leave_application/leave_application.py @@ -570,7 +570,7 @@ def notify_employee(self): frappe.msgprint(_("Please set default template for Leave Status Notification in HR Settings.")) return email_template = frappe.get_doc("Email Template", template) - message = frappe.render_template(email_template.response, args) + message = frappe.render_template(email_template.response_, args) self.notify( { @@ -595,7 +595,7 @@ def notify_leave_approver(self): ) return email_template = frappe.get_doc("Email Template", template) - message = frappe.render_template(email_template.response, args) + message = frappe.render_template(email_template.response_, args) self.notify( { From fb47d04d6b053a18664f12bc1700652cf5e07a42 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 11:26:45 +0530 Subject: [PATCH 3/4] fix(Monthly Attendance Sheet): parsing error for data values (backport #1446) (#1451) * fix(Monthly Attendance Sheet): parsing error for data values * test: fix days dict key type (cherry picked from commit ca7f63940e1aec33a390bde556b298845cc84b5e) Co-authored-by: Akash Tom <61287991+krantheman@users.noreply.github.com> --- .../monthly_attendance_sheet.py | 2 +- .../test_monthly_attendance_sheet.py | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hrms/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/hrms/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py index 938172a472..cf6a8cc97b 100644 --- a/hrms/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py +++ b/hrms/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py @@ -512,7 +512,7 @@ def get_attendance_status_for_detailed_view( status = get_holiday_status(day, holidays) abbr = status_map.get(status, "") - row[day] = abbr + row[cstr(day)] = abbr attendance_values.append(row) diff --git a/hrms/hr/report/monthly_attendance_sheet/test_monthly_attendance_sheet.py b/hrms/hr/report/monthly_attendance_sheet/test_monthly_attendance_sheet.py index aba2eaabf3..82e3e5e7ee 100644 --- a/hrms/hr/report/monthly_attendance_sheet/test_monthly_attendance_sheet.py +++ b/hrms/hr/report/monthly_attendance_sheet/test_monthly_attendance_sheet.py @@ -89,14 +89,14 @@ def test_detailed_view(self): row_without_shift = report[1][1] self.assertEqual(day_shift_row["shift"], "Day Shift") - self.assertEqual(day_shift_row[1], "A") # absent on the 1st day of the month - self.assertEqual(day_shift_row[2], "P") # present on the 2nd day + self.assertEqual(day_shift_row["1"], "A") # absent on the 1st day of the month + self.assertEqual(day_shift_row["2"], "P") # present on the 2nd day self.assertEqual(row_without_shift["shift"], "") - self.assertEqual(row_without_shift[4], "P") # present on the 4th day + self.assertEqual(row_without_shift["4"], "P") # present on the 4th day # leave should be shown against every shift - self.assertTrue(day_shift_row[3] == row_without_shift[3] == "L") + self.assertTrue(day_shift_row["3"] == row_without_shift["3"] == "L") @set_holiday_list("Salary Slip Test Holiday List", "_Test Company") def test_single_shift_with_leaves_in_detailed_view(self): @@ -125,9 +125,9 @@ def test_single_shift_with_leaves_in_detailed_view(self): day_shift_row = report[1][0] self.assertEqual(day_shift_row["shift"], "Day Shift") - self.assertEqual(day_shift_row[1], "A") # absent on the 1st day of the month - self.assertEqual(day_shift_row[2], "P") # present on the 2nd day - self.assertEqual(day_shift_row[3], "L") # leave on the 3rd day + self.assertEqual(day_shift_row["1"], "A") # absent on the 1st day of the month + self.assertEqual(day_shift_row["2"], "P") # present on the 2nd day + self.assertEqual(day_shift_row["3"], "L") # leave on the 3rd day @set_holiday_list("Salary Slip Test Holiday List", "_Test Company") def test_single_leave_record(self): @@ -150,7 +150,7 @@ def test_single_leave_record(self): row = report[1][0] self.assertIsNone(row["shift"]) - self.assertEqual(row[1], "L") + self.assertEqual(row["1"], "L") @set_holiday_list("Salary Slip Test Holiday List", "_Test Company") def test_summarized_view(self): @@ -233,12 +233,12 @@ def test_attendance_with_group_by_filter(self): row_without_shift = report[1][2] self.assertEqual(day_shift_row["shift"], "Day Shift") - self.assertEqual(day_shift_row[1], "A") # absent on the 1st day of the month - self.assertEqual(day_shift_row[2], "P") # present on the 2nd day + self.assertEqual(day_shift_row["1"], "A") # absent on the 1st day of the month + self.assertEqual(day_shift_row["2"], "P") # present on the 2nd day self.assertEqual(row_without_shift["shift"], "") - self.assertEqual(row_without_shift[3], "L") # on leave on the 3rd day - self.assertEqual(row_without_shift[4], "P") # present on the 4th day + self.assertEqual(row_without_shift["3"], "L") # on leave on the 3rd day + self.assertEqual(row_without_shift["4"], "P") # present on the 4th day def test_attendance_with_employee_filter(self): previous_month_first = get_first_day_for_prev_month() From 925af5189bbea8dbdf0c894f0562fbcd83f652eb Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 12:35:55 +0530 Subject: [PATCH 4/4] fix: leave application status vs max consecutive days calculation (backport #1447) (#1453) (cherry picked from commit 9d8c78de8b52256c3355202f6d1031cfde1bb4b2) Co-authored-by: avc <94137451+git-avc@users.noreply.github.com> --- .../leave_application/leave_application.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hrms/hr/doctype/leave_application/leave_application.py b/hrms/hr/doctype/leave_application/leave_application.py index f430c3e515..77f94da99a 100755 --- a/hrms/hr/doctype/leave_application/leave_application.py +++ b/hrms/hr/doctype/leave_application/leave_application.py @@ -480,7 +480,13 @@ def _get_first_from_date(reference_date): prev_date = add_days(reference_date, -1) application = frappe.db.get_value( "Leave Application", - {"employee": self.employee, "leave_type": self.leave_type, "to_date": prev_date}, + { + "employee": self.employee, + "leave_type": self.leave_type, + "to_date": prev_date, + "docstatus": ["!=", 2], + "status": ["in", ["Open", "Approved"]], + }, ["name", "from_date"], as_dict=True, ) @@ -494,7 +500,13 @@ def _get_last_to_date(reference_date): next_date = add_days(reference_date, 1) application = frappe.db.get_value( "Leave Application", - {"employee": self.employee, "leave_type": self.leave_type, "from_date": next_date}, + { + "employee": self.employee, + "leave_type": self.leave_type, + "from_date": next_date, + "docstatus": ["!=", 2], + "status": ["in", ["Open", "Approved"]], + }, ["name", "to_date"], as_dict=True, )