fix: rearrange buttons for company doctype (#25617)
This commit is contained in:
parent
4d61fa2497
commit
99636c6aca
@ -90,12 +90,6 @@ frappe.ui.form.on("Company", {
|
|||||||
frm.toggle_enable("default_currency", (frm.doc.__onload &&
|
frm.toggle_enable("default_currency", (frm.doc.__onload &&
|
||||||
!frm.doc.__onload.transactions_exist));
|
!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')) {
|
if (frappe.perm.has_perm("Cost Center", 0, 'read')) {
|
||||||
frm.add_custom_button(__('Cost Centers'), function() {
|
frm.add_custom_button(__('Cost Centers'), function() {
|
||||||
frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name});
|
frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name});
|
||||||
@ -121,17 +115,21 @@ frappe.ui.form.on("Company", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (frm.has_perm('write')) {
|
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");
|
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);
|
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) {
|
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) {
|
country: function(frm) {
|
||||||
erpnext.company.set_chart_of_accounts_options(frm.doc);
|
erpnext.company.set_chart_of_accounts_options(frm.doc);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -99,7 +99,6 @@
|
|||||||
"company_description",
|
"company_description",
|
||||||
"registration_info",
|
"registration_info",
|
||||||
"registration_details",
|
"registration_details",
|
||||||
"delete_company_transactions",
|
|
||||||
"lft",
|
"lft",
|
||||||
"rgt",
|
"rgt",
|
||||||
"old_parent"
|
"old_parent"
|
||||||
@ -666,11 +665,6 @@
|
|||||||
"oldfieldname": "registration_details",
|
"oldfieldname": "registration_details",
|
||||||
"oldfieldtype": "Code"
|
"oldfieldtype": "Code"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "delete_company_transactions",
|
|
||||||
"fieldtype": "Button",
|
|
||||||
"label": "Delete Company Transactions"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "lft",
|
"fieldname": "lft",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
@ -747,7 +741,7 @@
|
|||||||
"image_field": "company_logo",
|
"image_field": "company_logo",
|
||||||
"is_tree": 1,
|
"is_tree": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-02-16 15:53:37.167589",
|
"modified": "2021-05-07 03:11:28.189740",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"name": "Company",
|
"name": "Company",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user