[minor] re-verify password before deleting company transactions
This commit is contained in:
parent
c4d38e2183
commit
ed618f284b
@ -11,31 +11,37 @@ frappe.ui.form.on("Company", {
|
|||||||
erpnext.company.set_chart_of_accounts_options(frm.doc);
|
erpnext.company.set_chart_of_accounts_options(frm.doc);
|
||||||
},
|
},
|
||||||
delete_company_transactions: function(frm) {
|
delete_company_transactions: function(frm) {
|
||||||
var d = frappe.prompt({
|
frappe.verify_password(function() {
|
||||||
fieldtype:"Data",
|
var d = frappe.prompt({
|
||||||
fieldname: "company_name",
|
fieldtype:"Data",
|
||||||
label: __("Please re-type company name to confirm"),
|
fieldname: "company_name",
|
||||||
reqd: 1,
|
label: __("Please re-type company name to confirm"),
|
||||||
description: __("Please make sure you really want to delete all the transactions for this company. Your master data will remain as it is. This action cannot be undone.")},
|
reqd: 1,
|
||||||
function(data) {
|
description: __("Please make sure you really want to delete all the transactions for this company. Your master data will remain as it is. This action cannot be undone.")},
|
||||||
if(data.company_name !== frm.doc.name) {
|
function(data) {
|
||||||
frappe.msgprint("Company name not same");
|
if(data.company_name !== frm.doc.name) {
|
||||||
return;
|
frappe.msgprint("Company name not same");
|
||||||
}
|
return;
|
||||||
frappe.call({
|
|
||||||
method: "erpnext.setup.doctype.company.delete_company_transactions.delete_company_transactions",
|
|
||||||
args: {
|
|
||||||
company_name: data.company_name
|
|
||||||
},
|
|
||||||
freeze: true,
|
|
||||||
callback: function(r, rt) {
|
|
||||||
if(!r.exc)
|
|
||||||
frappe.msgprint(__("Successfully deleted all transactions related to this company!"));
|
|
||||||
}
|
}
|
||||||
});
|
frappe.call({
|
||||||
}, __("Delete all the Transactions for this Company"), __("Delete"));
|
method: "erpnext.setup.doctype.company.delete_company_transactions.delete_company_transactions",
|
||||||
|
args: {
|
||||||
d.get_primary_btn().addClass("btn-danger");
|
company_name: data.company_name
|
||||||
|
},
|
||||||
|
freeze: true,
|
||||||
|
callback: function(r, rt) {
|
||||||
|
if(!r.exc)
|
||||||
|
frappe.msgprint(__("Successfully deleted all transactions related to this company!"));
|
||||||
|
},
|
||||||
|
onerror: function() {
|
||||||
|
frappe.msgprint(__("Wrong Password"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, __("Delete all the Transactions for this Company"), __("Delete")
|
||||||
|
);
|
||||||
|
d.get_primary_btn().addClass("btn-danger");
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user