diff --git a/hrms/hr/doctype/leave_application/leave_application.py b/hrms/hr/doctype/leave_application/leave_application.py index ab617785d1..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, ) @@ -570,7 +582,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 +607,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( { 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) 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()