fix: do not show generate irn for invalid supply type

This commit is contained in:
Saqib Ansari
2020-09-30 15:17:30 +05:30
parent 389610fb45
commit 59a757b3e3

View File

@@ -2,7 +2,11 @@ erpnext.setup_einvoice_actions = (doctype) => {
frappe.ui.form.on(doctype, {
refresh(frm) {
const einvoicing_enabled = frappe.db.get_value("E Invoice Settings", "E Invoice Settings", "enable");
if (!einvoicing_enabled) return;
const supply_type = frm.doc.gst_category;
if (!einvoicing_enabled
|| !['Registered Regular', 'SEZ', 'Overseas', 'Deemed Export'].includes(supply_type)) {
return;
}
if (frm.doc.docstatus == 0 && !frm.doc.irn && !frm.doc.__unsaved) {
frm.add_custom_button(