fix: rearrange buttons for company doctype (#25617)

This commit is contained in:
Ganga Manoj 2021-05-25 19:17:01 +05:30 committed by GitHub
parent 4d61fa2497
commit 99636c6aca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 24 deletions

View File

@ -90,12 +90,6 @@ frappe.ui.form.on("Company", {
frm.toggle_enable("default_currency", (frm.doc.__onload &&
!frm.doc.__onload.transactions_exist));
if (frm.has_perm('write')) {
frm.add_custom_button(__('Create Tax Template'), function() {
frm.trigger("make_default_tax_template");
});
}
if (frappe.perm.has_perm("Cost Center", 0, 'read')) {
frm.add_custom_button(__('Cost Centers'), function() {
frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name});
@ -121,17 +115,21 @@ frappe.ui.form.on("Company", {
}
if (frm.has_perm('write')) {
frm.add_custom_button(__('Default Tax Template'), function() {
frm.add_custom_button(__('Create Tax Template'), function() {
frm.trigger("make_default_tax_template");
}, __('Create'));
}, __('Manage'));
}
if (frappe.user.has_role('System Manager')) {
if (frm.has_perm('write')) {
frm.add_custom_button(__('Delete Transactions'), function() {
frm.trigger("delete_company_transactions");
}, __('Manage'));
}
}
}
erpnext.company.set_chart_of_accounts_options(frm.doc);
if (!frappe.user.has_role('System Manager')) {
frm.get_field("delete_company_transactions").hide();
}
},
make_default_tax_template: function(frm) {
@ -145,11 +143,6 @@ frappe.ui.form.on("Company", {
})
},
onload_post_render: function(frm) {
if(frm.get_field("delete_company_transactions").$input)
frm.get_field("delete_company_transactions").$input.addClass("btn-danger");
},
country: function(frm) {
erpnext.company.set_chart_of_accounts_options(frm.doc);
},

View File

@ -99,7 +99,6 @@
"company_description",
"registration_info",
"registration_details",
"delete_company_transactions",
"lft",
"rgt",
"old_parent"
@ -666,11 +665,6 @@
"oldfieldname": "registration_details",
"oldfieldtype": "Code"
},
{
"fieldname": "delete_company_transactions",
"fieldtype": "Button",
"label": "Delete Company Transactions"
},
{
"fieldname": "lft",
"fieldtype": "Int",
@ -747,7 +741,7 @@
"image_field": "company_logo",
"is_tree": 1,
"links": [],
"modified": "2021-02-16 15:53:37.167589",
"modified": "2021-05-07 03:11:28.189740",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",