diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py index a451995531c..64349479a08 100644 --- a/erpnext/startup/boot.py +++ b/erpnext/startup/boot.py @@ -54,6 +54,7 @@ def boot_session(bootinfo): "country", "exchange_gain_loss_account", ], + limit_page_length=0, # intentionally unbounded: all companies are needed for boot ) for company in companies: company.doctype = ":Company" diff --git a/erpnext/startup/test_boot.py b/erpnext/startup/test_boot.py new file mode 100644 index 00000000000..05e3fa7ee6a --- /dev/null +++ b/erpnext/startup/test_boot.py @@ -0,0 +1,22 @@ +# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +import frappe + +from erpnext.tests.utils import ERPNextTestSuite + + +class TestBoot(ERPNextTestSuite): + def test_boot_session_populates_companies_and_party_types(self): + # boot_session reads Customer count, Company list and Party Type account types via ORM/qb + # (formerly raw SQL with ifnull, which is invalid on Postgres). Exercises that on both engines. + from erpnext.startup.boot import boot_session + + bootinfo = frappe._dict(sysdefaults=frappe._dict(), page_info=frappe._dict(), docs=[]) + boot_session(bootinfo) + + self.assertIsInstance(bootinfo.customer_count, int) + self.assertIn("party_account_types", bootinfo) + + company_docs = [d for d in bootinfo.docs if d.get("doctype") == ":Company"] + self.assertTrue(any(d.get("name") == "_Test Company" for d in company_docs))