Skip to content

Commit

Permalink
Merge pull request #1448 from frappe/version-14-hotfix
Browse files Browse the repository at this point in the history
chore: release v14
  • Loading branch information
ruchamahabal committed Feb 21, 2024
2 parents 019fc6a + 925af51 commit dfb49e6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 18 deletions.
20 changes: 16 additions & 4 deletions hrms/hr/doctype/leave_application/leave_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down Expand Up @@ -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(
{
Expand All @@ -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(
{
Expand Down
2 changes: 1 addition & 1 deletion hrms/hr/employee_property_update.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit dfb49e6

Please sign in to comment.