From ada1ac80133c519e7afc628bb8e4794c8b3f95e4 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Wed, 17 Jul 2019 15:38:21 +0530 Subject: [PATCH] fix: Added default dimension and filter in bootinfo --- .../accounting_dimension.js | 68 +++++++++++-------- .../accounting_dimension.json | 12 ++-- .../accounting_dimension.py | 8 +++ .../accounting_dimension_detail/__init__.py | 0 .../accounting_dimension_detail.json | 47 +++++++++++++ .../accounting_dimension_detail.py | 10 +++ .../journal_entry_account.json | 4 +- .../sales_invoice_item.json | 3 +- .../accounts_payable/accounts_payable.js | 15 ++-- .../accounts_payable_summary.js | 15 ++-- .../accounts_receivable.js | 15 ++-- .../accounts_receivable_summary.js | 14 ++-- .../budget_variance_report.js | 7 +- .../report/general_ledger/general_ledger.js | 15 ++-- .../profitability_analysis.js | 7 +- .../report/sales_register/sales_register.js | 15 ++-- .../report/trial_balance/trial_balance.js | 6 +- erpnext/public/js/financial_statements.js | 14 ++-- erpnext/public/js/utils.js | 14 ---- .../public/js/utils/dimension_tree_filter.js | 41 +++++++---- erpnext/startup/boot.py | 18 +++++ 21 files changed, 219 insertions(+), 129 deletions(-) create mode 100644 erpnext/accounts/doctype/accounting_dimension_detail/__init__.py create mode 100644 erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.json create mode 100644 erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.py diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js index ffb6d5e597..bb4d514981 100644 --- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js +++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.js @@ -8,41 +8,48 @@ frappe.ui.form.on('Accounting Dimension', { 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() { - - frm.set_value('disabled', 1 - frm.doc.disabled); - - frappe.call({ - method: "erpnext.accounts.doctype.accounting_dimension.accounting_dimension.disable_dimension", - args: { - doc: frm.doc - }, - freeze: true, - callback: function(r) { - let message = frm.doc.disabled ? "Dimension Disabled" : "Dimension Enabled"; - frm.save(); - frappe.show_alert({message:__(message), indicator:'green'}); - } + 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() { + + frm.set_value('disabled', 1 - frm.doc.disabled); + + frappe.call({ + method: "erpnext.accounts.doctype.accounting_dimension.accounting_dimension.disable_dimension", + args: { + doc: frm.doc + }, + freeze: true, + callback: function(r) { + let message = frm.doc.disabled ? "Dimension Disabled" : "Dimension Enabled"; + frm.save(); + frappe.show_alert({message:__(message), indicator:'green'}); + } + }); + }); + } }, document_type: function(frm) { + frm.set_value('label', frm.doc.document_type); frm.set_value('fieldname', frappe.model.scrub(frm.doc.document_type)); + if (frm.is_new()){ + let row = frappe.model.add_child(frm.doc, "Accounting Dimension Detail", "dimension_defaults"); + row.reference_document = frm.doc.document_type; + frm.refresh_fields("dimension_defaults"); + } + frappe.db.get_value('Accounting Dimension', {'document_type': frm.doc.document_type}, 'document_type', (r) => { if (r && r.document_type) { frm.set_df_property('document_type', 'description', "Document type is already set as dimension"); @@ -50,3 +57,10 @@ frappe.ui.form.on('Accounting Dimension', { }); }, }); + +frappe.ui.form.on('Accounting Dimension Detail', { + dimension_defaults_add: function(frm, cdt, cdn) { + let row = locals[cdt][cdn]; + row.reference_document = frm.doc.document_type; + } +}) \ No newline at end of file diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json index 0fab74d522..19fa9bf837 100644 --- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json +++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json @@ -9,7 +9,7 @@ "document_type", "label", "fieldname", - "default_dimension", + "dimension_defaults", "mandatory_for_bs", "mandatory_for_pl", "disabled" @@ -56,13 +56,13 @@ "label": "Mandatory For Profit and Loss Account" }, { - "fieldname": "default_dimension", - "fieldtype": "Dynamic Link", - "label": "Default Dimension", - "options": "document_type" + "fieldname": "dimension_defaults", + "fieldtype": "Table", + "label": "Dimension Defaults", + "options": "Accounting Dimension Detail" } ], - "modified": "2019-07-14 19:16:25.405924", + "modified": "2019-07-16 18:00:11.365510", "modified_by": "Administrator", "module": "Accounts", "name": "Accounting Dimension", diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py index 314849847c..218ab596e3 100644 --- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py +++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py @@ -144,6 +144,14 @@ def toggle_disabling(doc): frappe.clear_cache(doctype=doctype) + dimension_filters = frappe.db.sql(""" + SELECT label, fieldname, document_type + FROM `tabAccounting Dimension` + WHERE disabled = 0 + """, as_dict=1) + + return dimension_filters + def get_doctypes_with_dimensions(): doclist = ["GL Entry", "Sales Invoice", "Purchase Invoice", "Payment Entry", "Asset", "Expense Claim", "Stock Entry", "Budget", "Payroll Entry", "Delivery Note", "Sales Invoice Item", "Purchase Invoice Item", diff --git a/erpnext/accounts/doctype/accounting_dimension_detail/__init__.py b/erpnext/accounts/doctype/accounting_dimension_detail/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.json b/erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.json new file mode 100644 index 0000000000..f46a065271 --- /dev/null +++ b/erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.json @@ -0,0 +1,47 @@ +{ + "creation": "2019-07-16 17:53:18.718831", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "company", + "reference_document", + "default_dimension" + ], + "fields": [ + { + "fieldname": "company", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Company", + "options": "Company", + "reqd": 1 + }, + { + "fieldname": "reference_document", + "fieldtype": "Link", + "hidden": 1, + "label": "Reference Document", + "options": "DocType", + "read_only": 1 + }, + { + "fieldname": "default_dimension", + "fieldtype": "Dynamic Link", + "in_list_view": 1, + "label": "Default Dimension", + "options": "reference_document", + "reqd": 1 + } + ], + "istable": 1, + "modified": "2019-07-16 18:54:52.202378", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Accounting Dimension Detail", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.py b/erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.py new file mode 100644 index 0000000000..17cf549fc4 --- /dev/null +++ b/erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class AccountingDimensionDetail(Document): + pass diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json index e4acf5a03d..8728950286 100644 --- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json +++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json @@ -258,6 +258,7 @@ "print_hide": 1 }, { + "collapsible": 1, "fieldname": "accounting_dimensions_section", "fieldtype": "Section Break", "label": "Accounting Dimensions" @@ -269,12 +270,13 @@ ], "idx": 1, "istable": 1, - "modified": "2019-05-25 22:14:02.715509", + "modified": "2019-07-16 17:12:08.238334", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Entry Account", "owner": "Administrator", "permissions": [], + "sort_field": "modified", "sort_order": "DESC", "track_changes": 1 } \ No newline at end of file diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json index 465df277fd..779ac4f656 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json @@ -764,6 +764,7 @@ "label": "Image" }, { + "collapsible": 1, "fieldname": "accounting_dimensions_section", "fieldtype": "Section Break", "label": "Accounting Dimensions" @@ -782,7 +783,7 @@ ], "idx": 1, "istable": 1, - "modified": "2019-06-28 17:30:12.156086", + "modified": "2019-07-16 16:36:46.527606", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Item", diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js index cfcc575718..5e07d080fb 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.js +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js @@ -115,13 +115,12 @@ frappe.query_reports["Accounts Payable"] = { } } -erpnext.dimension_filters.then((dimensions) => { - dimensions.forEach((dimension) => { - frappe.query_reports["Accounts Payable"].filters.splice(9, 0 ,{ - "fieldname": dimension["fieldname"], - "label": __(dimension["label"]), - "fieldtype": "Link", - "options": dimension["document_type"] - }); +frappe.boot.dimension_filters.forEach((dimension) => { + frappe.query_reports["Accounts Payable"].filters.splice(9, 0 ,{ + "fieldname": dimension["fieldname"], + "label": __(dimension["label"]), + "fieldtype": "Link", + "options": dimension["document_type"] }); }); + diff --git a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js index 006068a266..426de6782d 100644 --- a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js +++ b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js @@ -99,13 +99,12 @@ frappe.query_reports["Accounts Payable Summary"] = { } } -erpnext.dimension_filters.then((dimensions) => { - dimensions.forEach((dimension) => { - frappe.query_reports["Accounts Payable Summary"].filters.splice(9, 0 ,{ - "fieldname": dimension["fieldname"], - "label": __(dimension["label"]), - "fieldtype": "Link", - "options": dimension["document_type"] - }); +frappe.boot.dimension_filters.forEach((dimension) => { + frappe.query_reports["Accounts Payable Summary"].filters.splice(9, 0 ,{ + "fieldname": dimension["fieldname"], + "label": __(dimension["label"]), + "fieldtype": "Link", + "options": dimension["document_type"] }); }); + diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js index 2a45454bac..816e43898a 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js @@ -173,13 +173,12 @@ frappe.query_reports["Accounts Receivable"] = { } } -erpnext.dimension_filters.then((dimensions) => { - dimensions.forEach((dimension) => { - frappe.query_reports["Accounts Receivable"].filters.splice(9, 0 ,{ - "fieldname": dimension["fieldname"], - "label": __(dimension["label"]), - "fieldtype": "Link", - "options": dimension["document_type"] - }); +frappe.boot.dimension_filters.forEach((dimension) => { + frappe.query_reports["Accounts Receivable"].filters.splice(9, 0 ,{ + "fieldname": dimension["fieldname"], + "label": __(dimension["label"]), + "fieldtype": "Link", + "options": dimension["document_type"] }); }); + diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js index a7c0787fcd..d63af8b3f3 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js @@ -117,13 +117,11 @@ frappe.query_reports["Accounts Receivable Summary"] = { } } -erpnext.dimension_filters.then((dimensions) => { - dimensions.forEach((dimension) => { - frappe.query_reports["Accounts Receivable Summary"].filters.splice(9, 0 ,{ - "fieldname": dimension["fieldname"], - "label": __(dimension["label"]), - "fieldtype": "Link", - "options": dimension["document_type"] - }); +frappe.boot.dimension_filters.forEach((dimension) => { + frappe.query_reports["Accounts Receivable Summary"].filters.splice(9, 0 ,{ + "fieldname": dimension["fieldname"], + "label": __(dimension["label"]), + "fieldtype": "Link", + "options": dimension["document_type"] }); }); diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js index f2a33a83ee..33dc555a95 100644 --- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js +++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js @@ -63,8 +63,7 @@ frappe.query_reports["Budget Variance Report"] = { ] } -erpnext.dimension_filters.then((dimensions) => { - dimensions.forEach((dimension) => { - frappe.query_reports["Budget Variance Report"].filters[4].options.push(dimension["document_type"]); - }); +frappe.boot.dimension_filters.forEach((dimension) => { + frappe.query_reports["Budget Variance Report"].filters[4].options.push(dimension["document_type"]); }); + diff --git a/erpnext/accounts/report/general_ledger/general_ledger.js b/erpnext/accounts/report/general_ledger/general_ledger.js index ea82575b80..74a1ea70ac 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.js +++ b/erpnext/accounts/report/general_ledger/general_ledger.js @@ -159,13 +159,12 @@ frappe.query_reports["General Ledger"] = { ] } -erpnext.dimension_filters.then((dimensions) => { - dimensions.forEach((dimension) => { - frappe.query_reports["General Ledger"].filters.splice(15, 0 ,{ - "fieldname": dimension["fieldname"], - "label": __(dimension["label"]), - "fieldtype": "Link", - "options": dimension["document_type"] - }); +frappe.boot.dimension_filters.forEach((dimension) => { + frappe.query_reports["General Ledger"].filters.splice(15, 0 ,{ + "fieldname": dimension["fieldname"], + "label": __(dimension["label"]), + "fieldtype": "Link", + "options": dimension["document_type"] }); }); + diff --git a/erpnext/accounts/report/profitability_analysis/profitability_analysis.js b/erpnext/accounts/report/profitability_analysis/profitability_analysis.js index d6864b54f7..2656a7e7b5 100644 --- a/erpnext/accounts/report/profitability_analysis/profitability_analysis.js +++ b/erpnext/accounts/report/profitability_analysis/profitability_analysis.js @@ -105,9 +105,8 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { "initial_depth": 3 } - erpnext.dimension_filters.then((dimensions) => { - dimensions.forEach((dimension) => { - frappe.query_reports["Profitability Analysis"].filters[1].options.push(dimension["document_type"]); - }); + frappe.boot.dimension_filters.forEach((dimension) => { + frappe.query_reports["Profitability Analysis"].filters[1].options.push(dimension["document_type"]); }); + }); diff --git a/erpnext/accounts/report/sales_register/sales_register.js b/erpnext/accounts/report/sales_register/sales_register.js index 442aa1262e..105f5a29c1 100644 --- a/erpnext/accounts/report/sales_register/sales_register.js +++ b/erpnext/accounts/report/sales_register/sales_register.js @@ -68,13 +68,12 @@ frappe.query_reports["Sales Register"] = { ] } -erpnext.dimension_filters.then((dimensions) => { - dimensions.forEach((dimension) => { - frappe.query_reports["Sales Register"].filters.splice(7, 0 ,{ - "fieldname": dimension["fieldname"], - "label": __(dimension["label"]), - "fieldtype": "Link", - "options": dimension["document_type"] - }); +frappe.boot.dimension_filters.forEach((dimension) => { + frappe.query_reports["Sales Register"].filters.splice(7, 0 ,{ + "fieldname": dimension["fieldname"], + "label": __(dimension["label"]), + "fieldtype": "Link", + "options": dimension["document_type"] }); }); + diff --git a/erpnext/accounts/report/trial_balance/trial_balance.js b/erpnext/accounts/report/trial_balance/trial_balance.js index 73d2ab3898..dc6d07e2bb 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.js +++ b/erpnext/accounts/report/trial_balance/trial_balance.js @@ -94,10 +94,8 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { "parent_field": "parent_account", "initial_depth": 3 } -}); -erpnext.dimension_filters.then((dimensions) => { - dimensions.forEach((dimension) => { + frappe.boot.dimension_filters.forEach((dimension) => { frappe.query_reports["Trial Balance"].filters.splice(5, 0 ,{ "fieldname": dimension["fieldname"], "label": __(dimension["label"]), @@ -107,3 +105,5 @@ erpnext.dimension_filters.then((dimensions) => { }); }); + + diff --git a/erpnext/public/js/financial_statements.js b/erpnext/public/js/financial_statements.js index 89cb13d981..5feedd3e15 100644 --- a/erpnext/public/js/financial_statements.js +++ b/erpnext/public/js/financial_statements.js @@ -129,14 +129,12 @@ function get_filters(){ } ] - erpnext.dimension_filters.then((dimensions) => { - dimensions.forEach((dimension) => { - filters.push({ - "fieldname": dimension["fieldname"], - "label": __(dimension["label"]), - "fieldtype": "Link", - "options": dimension["document_type"] - }); + frappe.boot.dimension_filters.forEach((dimension) => { + filters.push({ + "fieldname": dimension["fieldname"], + "label": __(dimension["label"]), + "fieldtype": "Link", + "options": dimension["document_type"] }); }); diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 1c5e98eb7d..0a363a04fd 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -63,20 +63,6 @@ $.extend(erpnext, { me.show_serial_batch_selector(grid_row.frm, grid_row.doc); }); }, - - get_dimension_filters: async function() { - if (!frappe.model.can_read('Accounting Dimension')) { - return []; - } - let dimensions = await frappe.db.get_list('Accounting Dimension', { - fields: ['label', 'fieldname', 'document_type', 'default_dimension'], - filters: { - disabled: 0 - } - }); - - return dimensions; - } }); diff --git a/erpnext/public/js/utils/dimension_tree_filter.js b/erpnext/public/js/utils/dimension_tree_filter.js index 4a82edda69..22b4834dfb 100644 --- a/erpnext/public/js/utils/dimension_tree_filter.js +++ b/erpnext/public/js/utils/dimension_tree_filter.js @@ -7,25 +7,40 @@ erpnext.doctypes_with_dimensions = ["GL Entry", "Sales Invoice", "Purchase Invoi "Landed Cost Item", "Asset Value Adjustment", "Loyalty Program", "Fee Schedule", "Fee Structure", "Stock Reconciliation", "Travel Request", "Fees", "POS Profile"]; -erpnext.dimension_filters = erpnext.get_dimension_filters(); - erpnext.doctypes_with_dimensions.forEach((doctype) => { frappe.ui.form.on(doctype, { onload: function(frm) { - erpnext.dimension_filters.then((dimensions) => { - dimensions.forEach((dimension) => { - if (dimension['default_dimension']) { - frm.set_value(dimension['fieldname'], dimension['default_dimension']); + frappe.boot.dimension_filters.forEach((dimension) => { + frappe.model.with_doctype(dimension['document_type'], () => { + if (frappe.meta.has_field(dimension['document_type'], 'is_group')) { + frm.set_query(dimension['fieldname'], { + "is_group": 0 + }); } - frappe.model.with_doctype(dimension['document_type'], () => { - if (frappe.meta.has_field(dimension['document_type'], 'is_group')) { - frm.set_query(dimension['fieldname'], { - "is_group": 0 - }); - } - }); }); }); + }, + + company: function(frm) { + if(frm.doc.company) { + frappe.boot.dimension_filters.forEach((dimension) => { + frm.set_value(dimension['fieldname'], frappe.boot.default_dimensions[frm.doc.company][dimension['document_type']]); + }); + } + }, + + items_add: function(frm, cdt, cdn) { + frappe.boot.dimension_filters.forEach((dimension) => { + var row = frappe.get_doc(cdt, cdn); + frm.script_manager.copy_from_first_row("items", row, [dimension['fieldname']]); + }); + }, + + accounts_add: function(frm, cdt, cdn) { + frappe.boot.dimension_filters.forEach((dimension) => { + var row = frappe.get_doc(cdt, cdn); + frm.script_manager.copy_from_first_row("accounts", row, [dimension['fieldname']]); + }); } }); }); \ No newline at end of file diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py index 4ca43a89b8..7d70cc2349 100644 --- a/erpnext/startup/boot.py +++ b/erpnext/startup/boot.py @@ -39,6 +39,8 @@ def boot_session(bootinfo): party_account_types = frappe.db.sql(""" select name, ifnull(account_type, '') from `tabParty Type`""") bootinfo.party_account_types = frappe._dict(party_account_types) + load_dimension_filters(bootinfo) + load_default_dimensions(bootinfo) def load_country_and_currency(bootinfo): country = frappe.db.get_default("country") @@ -49,6 +51,22 @@ def load_country_and_currency(bootinfo): number_format, smallest_currency_fraction_value, symbol from tabCurrency where enabled=1""", as_dict=1, update={"doctype":":Currency"}) +def load_dimension_filters(bootinfo): + bootinfo.dimension_filters = frappe.db.sql(""" + SELECT label, fieldname, document_type + FROM `tabAccounting Dimension` + WHERE disabled = 0 + """, as_dict=1) + +def load_default_dimensions(bootinfo): + default_dimensions = frappe.db.sql("""SELECT parent, company, default_dimension + FROM `tabAccounting Dimension Detail`""", as_dict=1) + + bootinfo.default_dimensions = {} + for dimension in default_dimensions: + bootinfo.default_dimensions.setdefault(dimension['company'], {}) + bootinfo.default_dimensions[dimension['company']][dimension['parent']] = dimension['default_dimension'] + def update_page_info(bootinfo): bootinfo.page_info.update({ "Chart of Accounts": {