diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js index d5f39b5cd39..88b11dd6780 100644 --- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js +++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js @@ -4,19 +4,19 @@ frappe.ui.form.on('Accounting Dimension', { refresh: function(frm) { + frm.set_query('document_type', () => { + return { + filters: { + name: ['not in', ['Accounting Dimension', 'Project', 'Cost Center', 'Accounting Dimension Detail']] + } + }; + }); + if (!frm.is_new()) { frm.add_custom_button(__('Show {0}', [frm.doc.document_type]), function () { frappe.set_route("List", frm.doc.document_type); }); - frm.set_query('document_type', () => { - return { - filters: { - name: ['not in', ['Accounting Dimension', 'Project', 'Cost Center']] - } - }; - }); - let button = frm.doc.disabled ? "Enable" : "Disable"; frm.add_custom_button(__(button), function() {