diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py index 7e51db2978b..0a81fe5eec6 100644 --- a/erpnext/hr/doctype/attendance/attendance.py +++ b/erpnext/hr/doctype/attendance/attendance.py @@ -253,10 +253,12 @@ 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]: + 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 = [ 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"),