From 5dfe4df23b8dd282fdbda33ab7ce4ae4970bdf6a Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Sat, 20 Jul 2019 17:53:29 +0530 Subject: [PATCH] fix: Set query fix --- .../accounting_dimension/accounting_dimension.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js index d5f39b5cd3..88b11dd678 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() {