fix: Error handling in Upload Attendance (#23907)
diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.js b/erpnext/hr/doctype/upload_attendance/upload_attendance.js
index 9df2948..29aa854 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.js
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.js
@@ -24,10 +24,10 @@
}
window.location.href = repl(frappe.request.url +
'?cmd=%(cmd)s&from_date=%(from_date)s&to_date=%(to_date)s', {
- cmd: "erpnext.hr.doctype.upload_attendance.upload_attendance.get_template",
- from_date: this.frm.doc.att_fr_date,
- to_date: this.frm.doc.att_to_date,
- });
+ cmd: "erpnext.hr.doctype.upload_attendance.upload_attendance.get_template",
+ from_date: this.frm.doc.att_fr_date,
+ to_date: this.frm.doc.att_to_date,
+ });
},
show_upload() {
diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.py b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
index edf05e8..674c8e3 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.py
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
@@ -28,7 +28,12 @@
w = UnicodeWriter()
w = add_header(w)
- w = add_data(w, args)
+ try:
+ w = add_data(w, args)
+ except Exception as e:
+ frappe.clear_messages()
+ frappe.respond_as_web_page("Holiday List Missing", html=e)
+ return
# write out response as a type csv
frappe.response['result'] = cstr(w.getvalue())