2019-03-01 07:03:19 +00:00
|
|
|
erpnext.setup_e_invoice_button = (doctype) => {
|
|
|
|
frappe.ui.form.on(doctype, {
|
|
|
|
refresh: (frm) => {
|
|
|
|
if(frm.doc.docstatus == 1) {
|
|
|
|
frm.add_custom_button('Generate E-Invoice', () => {
|
2019-03-01 08:28:39 +00:00
|
|
|
var w = window.open(
|
|
|
|
frappe.urllib.get_full_url(
|
|
|
|
"/api/method/erpnext.regional.italy.utils.generate_single_invoice?"
|
|
|
|
+ "docname=" + frm.doc.name
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if (!w) {
|
|
|
|
frappe.msgprint(__("Please enable pop-ups")); return;
|
|
|
|
}
|
2019-03-01 07:03:19 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|