mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 13:24:47 +00:00
chore: clean up einvoice actions
This commit is contained in:
@@ -10,24 +10,19 @@ erpnext.setup_einvoice_actions = (doctype) => {
|
||||
const { docstatus, irn, irn_cancelled, ewaybill, eway_bill_cancelled, doctype, name, __unsaved } = frm.doc;
|
||||
|
||||
if (docstatus == 0 && !irn && !__unsaved) {
|
||||
frm.add_custom_button(
|
||||
__("Generate IRN"),
|
||||
() => {
|
||||
const action = () => {
|
||||
frappe.call({
|
||||
method: 'erpnext.regional.india.e_invoice.utils.generate_irn',
|
||||
args: { doctype: doctype, name: name },
|
||||
freeze: true,
|
||||
callback: () => frm.reload_doc()
|
||||
})
|
||||
},
|
||||
__("E Invoicing")
|
||||
);
|
||||
};
|
||||
|
||||
frm.add_custom_button(__("Generate IRN"), action, __('E Invoicing'));
|
||||
}
|
||||
|
||||
if (docstatus == 1 && irn && !irn_cancelled) {
|
||||
frm.add_custom_button(
|
||||
__("Cancel IRN"),
|
||||
() => {
|
||||
const fields = [
|
||||
{
|
||||
"label" : "Reason",
|
||||
@@ -44,6 +39,7 @@ erpnext.setup_einvoice_actions = (doctype) => {
|
||||
"reqd": 1
|
||||
}
|
||||
];
|
||||
const action = () => {
|
||||
const d = new frappe.ui.Dialog({
|
||||
title: __("Cancel IRN"),
|
||||
fields: fields,
|
||||
@@ -66,15 +62,11 @@ erpnext.setup_einvoice_actions = (doctype) => {
|
||||
primary_action_label: __('Submit')
|
||||
});
|
||||
d.show();
|
||||
},
|
||||
__("E Invoicing")
|
||||
)
|
||||
};
|
||||
frm.add_custom_button(__("Cancel IRN"), action, __("E Invoicing"));
|
||||
}
|
||||
|
||||
if (docstatus == 1 && irn && !irn_cancelled && !eway_bill_cancelled) {
|
||||
frm.add_custom_button(
|
||||
__("Cancel E-Way Bill"),
|
||||
() => {
|
||||
const fields = [
|
||||
{
|
||||
"label" : "Reason",
|
||||
@@ -90,7 +82,8 @@ erpnext.setup_einvoice_actions = (doctype) => {
|
||||
"fieldtype": "Data",
|
||||
"reqd": 1
|
||||
}
|
||||
]
|
||||
];
|
||||
const action = () => {
|
||||
const d = new frappe.ui.Dialog({
|
||||
title: __('Cancel E-Way Bill'),
|
||||
fields: fields,
|
||||
@@ -113,9 +106,8 @@ erpnext.setup_einvoice_actions = (doctype) => {
|
||||
primary_action_label: __('Submit')
|
||||
});
|
||||
d.show();
|
||||
},
|
||||
__("E Invoicing")
|
||||
);
|
||||
};
|
||||
frm.add_custom_button(__("Cancel E-Way Bill"), action, __("E Invoicing"));
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user