diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.js b/erpnext/hr/doctype/upload_attendance/upload_attendance.js
index 776fd3c13b0..277c060d6a2 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.js
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.js
@@ -29,19 +29,12 @@ erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
});
},
- show_upload: function() {
- var me = this;
+ show_upload() {
var $wrapper = $(cur_frm.fields_dict.upload_html.wrapper).empty();
-
- // upload
- frappe.upload.make({
- parent: $wrapper,
- args: {
- method: 'erpnext.hr.doctype.upload_attendance.upload_attendance.upload'
- },
- no_socketio: true,
- sample_url: "e.g. http://example.com/somefile.csv",
- callback: function(attachment, r) {
+ new frappe.ui.FileUploader({
+ wrapper: $wrapper,
+ method: 'erpnext.hr.doctype.upload_attendance.upload_attendance.upload',
+ on_success(file_doc, r) {
var $log_wrapper = $(cur_frm.fields_dict.import_log.wrapper).empty();
if(!r.messages) r.messages = [];
@@ -59,10 +52,10 @@ erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
});
r.messages = ["
"+__("Import Failed!")+"
"]
- .concat(r.messages)
+ .concat(r.messages);
} else {
- r.messages = [""+__("Import Successful!")+"
"].
- concat(r.message.messages)
+ r.messages = [""+__("Import Successful!")+"
"]
+ .concat(r.message.messages);
}
$.each(r.messages, function(i, v) {
@@ -79,11 +72,7 @@ erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
});
}
});
-
- // rename button
- $wrapper.find('form input[type="submit"]')
- .attr('value', 'Upload and Import')
- }
+ },
})
cur_frm.cscript = new erpnext.hr.AttendanceControlPanel({frm: cur_frm});
diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.py b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
index db74b102a70..6a4ea6a5702 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.py
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
@@ -116,10 +116,10 @@ def upload():
if not frappe.has_permission("Attendance", "create"):
raise frappe.PermissionError
- from frappe.utils.csvutils import read_csv_content_from_uploaded_file
+ from frappe.utils.csvutils import read_csv_content
from frappe.modules import scrub
- rows = read_csv_content_from_uploaded_file()
+ rows = read_csv_content(frappe.local.uploaded_file)
rows = list(filter(lambda x: x and any(x), rows))
if not rows:
msg = [_("Please select a csv file")]