fix: display generate txt on submission

This commit is contained in:
Mangesh-Khairnar 2019-05-08 15:58:26 +05:30
parent 0b2fc4fbc1
commit 8aa9589aaf

View File

@ -1,6 +1,6 @@
frappe.ui.form.on('Payment Order', {
refresh: function(frm) {
if (frm.doc.docstatus==1 && frm.doc.payment_order_type==='Payment Request') {
if (frm.doc.docstatus==1 && frm.doc.payment_order_type==='Payment Entry') {
frm.add_custom_button(__('Generate Text File'),
function() {
frm.trigger("generate_text_and_download_file");
@ -15,7 +15,15 @@ frappe.ui.form.on('Payment Order', {
},
freeze: true,
callback: function(r) {
frm.refresh();
{
frm.refresh();
const a = document.createElement('a');
let file_obj = r.message;
a.href = file_obj.file_url;
a.target = '_blank';
a.download = file_obj.file_name;
a.click();
}
}
});
}