fix: reload account timeline before creating dashboards (#18934)
* fix: sync account balance timeline.json before running patch
* fix: reload account timeline before creating dashboards
diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py
index 7123021..6dbb890 100644
--- a/erpnext/setup/setup_wizard/operations/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py
@@ -502,8 +502,17 @@
def add_dashboards():
from erpnext.setup.setup_wizard.data.dashboard_charts import get_default_dashboards
+ from frappe.modules.import_file import import_file_by_path
+
dashboard_data = get_default_dashboards()
+ # create account balance timeline before creating dashbaord charts
+ doctype = "dashboard_chart_source"
+ docname = "account_balance_timeline"
+ folder = os.path.dirname(frappe.get_module("erpnext.accounts").__file__)
+ doc_path = os.path.join(folder, doctype, docname, docname) + ".json"
+ import_file_by_path(doc_path, force=0, for_sync=True)
+
make_records(dashboard_data["Charts"])
make_records(dashboard_data["Dashboards"])