Gaurav | b30a9b1 | 2019-03-01 12:33:19 +0530 | [diff] [blame] | 1 | erpnext.setup_e_invoice_button = (doctype) => { |
| 2 | frappe.ui.form.on(doctype, { |
| 3 | refresh: (frm) => { |
| 4 | if(frm.doc.docstatus == 1) { |
| 5 | frm.add_custom_button('Generate E-Invoice', () => { |
Gaurav | 6a4625b | 2019-03-01 13:58:39 +0530 | [diff] [blame] | 6 | var w = window.open( |
| 7 | frappe.urllib.get_full_url( |
| 8 | "/api/method/erpnext.regional.italy.utils.generate_single_invoice?" |
| 9 | + "docname=" + frm.doc.name |
| 10 | ) |
| 11 | ) |
| 12 | if (!w) { |
| 13 | frappe.msgprint(__("Please enable pop-ups")); return; |
| 14 | } |
Gaurav | b30a9b1 | 2019-03-01 12:33:19 +0530 | [diff] [blame] | 15 | }); |
| 16 | } |
| 17 | } |
| 18 | }); |
| 19 | }; |