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