<commit_before>frappe.ui.form.on('Payment Order', {
	refresh: function(frm) {
        if (frm.doc.docstatus==1 && frm.doc.payment_order_type==='Payment Request') {
            frm.add_custom_button(__('Generate Text File'),
				function() {
					frm.trigger("generate_text_and_download_file");
            });
        }
    },
    generate_text_and_download_file: (frm) => {
        return frappe.call({
            method: "erpnext.regional.india.bank_remittance_txt.generate_report",
            args: {
                name: frm.doc.name
            },
            freeze: true,
            callback: function(r) {
                frm.refresh();
            }
        });
    }
});<commit_msg>fix: display generate txt on submission<commit_after>frappe.ui.form.on('Payment Order', {
	refresh: function(frm) {
        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");
            });
        }
    },
    generate_text_and_download_file: (frm) => {
        return frappe.call({
            method: "erpnext.regional.india.bank_remittance_txt.generate_report",
            args: {
                name: frm.doc.name
            },
            freeze: true,
            callback: function(r) {
                {
                    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();
				}
            }
        });
    }
});
{'fraction_non_alphanumeric': 0.13237063778580024, 'fraction_numerical': 0.0012033694344163659, 'mean_word_length': 1.7624584717607974, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2888334', 'n_tokens_mistral': 542, 'n_tokens_neox': 505, 'n_words': 72}