Hi,
Am trying to build my own custom csv importer. So I am trying to add a JS file to the newly create doctype file which would help me with importing
frappe.provide("erpnext");
erpnext.UploadItems = frappe.ui.form.Controller.extend({
setup: function() {
this.show_upload();
},
show_upload: function() {
var me = this;
var $wrapper = $(cur_frm.fields_dict.upload_html.wrapper).empty();
// upload
frappe.upload.make({
parent: $wrapper,
args: {
method: 'erpnext.selling.doctype.upload_items.upload'
},
sample_url: "e.g. http://example.com/somefile.csv",
callback: function(attachment, r) {
me.frm.set_value("reconciliation_json", JSON.stringify(r.message));
me.show_reconciliation_data();
me.frm.save();
}
});
// rename button
$wrapper.find('form input[type="submit"]')
.attr('value', 'Upload')
},
});
The above code, I copied from stock_reconciliation. I am not able to create the Upload file field in the UI . What am I doing wrong?