From 6f8d62088e22bf7ce96e5396b0e24c7ab2c39a86 Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Fri, 30 Sep 2022 14:46:57 +0530 Subject: [PATCH 1/4] fix: mark attendance issue with joining date --- erpnext/hr/doctype/attendance/attendance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py index 7e51db2978b..e24079ed318 100644 --- a/erpnext/hr/doctype/attendance/attendance.py +++ b/erpnext/hr/doctype/attendance/attendance.py @@ -253,7 +253,7 @@ def get_unmarked_days(employee, month, exclude_holidays=0): start_day = 1 end_day = calendar.monthrange(today.year, month_map[month])[1] + 1 - if joining_date and joining_date.month == month_map[month]: + if joining_date and joining_date.year == today.year and joining_date.month == month_map[month]: start_day = joining_date.day if relieving_date and relieving_date.month == month_map[month]: From cb4fbd54325dbe0a831308b477a7a2a6c0b0c29e Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Fri, 30 Sep 2022 14:48:30 +0530 Subject: [PATCH 2/4] fix: future attendance marking --- erpnext/hr/doctype/attendance/attendance_list.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/hr/doctype/attendance/attendance_list.js b/erpnext/hr/doctype/attendance/attendance_list.js index 3a5c5915396..7d69a83e35b 100644 --- a/erpnext/hr/doctype/attendance/attendance_list.js +++ b/erpnext/hr/doctype/attendance/attendance_list.js @@ -13,6 +13,8 @@ frappe.listview_settings['Attendance'] = { onload: function(list_view) { let me = this; const months = moment.months(); + const curMonth = moment().format("MMMM"); + months.splice(months.indexOf(curMonth) + 1); list_view.page.add_inner_button(__("Mark Attendance"), function() { let dialog = new frappe.ui.Dialog({ title: __("Mark Attendance"), From a9546dd01f5781c3a64c42bb61d0d05c2f4922da Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Fri, 30 Sep 2022 15:27:03 +0530 Subject: [PATCH 3/4] fix: mark attendance issue with relieving date --- erpnext/hr/doctype/attendance/attendance.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py index e24079ed318..b4650d57da0 100644 --- a/erpnext/hr/doctype/attendance/attendance.py +++ b/erpnext/hr/doctype/attendance/attendance.py @@ -256,7 +256,11 @@ def get_unmarked_days(employee, month, exclude_holidays=0): if joining_date and joining_date.year == today.year and joining_date.month == month_map[month]: start_day = joining_date.day - if relieving_date and relieving_date.month == month_map[month]: + if ( + relieving_date + and relieving_date.year == today.year + and relieving_date.month == month_map[month] + ): end_day = relieving_date.day + 1 dates_of_month = [ From 308c400c6abc2ead54707d9ff1b96656ec21c5b0 Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Fri, 30 Sep 2022 15:33:34 +0530 Subject: [PATCH 4/4] chore: make linter happy --- erpnext/hr/doctype/attendance/attendance.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py index b4650d57da0..0a81fe5eec6 100644 --- a/erpnext/hr/doctype/attendance/attendance.py +++ b/erpnext/hr/doctype/attendance/attendance.py @@ -257,9 +257,7 @@ def get_unmarked_days(employee, month, exclude_holidays=0): start_day = joining_date.day if ( - relieving_date - and relieving_date.year == today.year - and relieving_date.month == month_map[month] + relieving_date and relieving_date.year == today.year and relieving_date.month == month_map[month] ): end_day = relieving_date.day + 1