From 1c773bb5e47890d26701e28623a724e429625a76 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sun, 19 Apr 2026 16:20:09 -0400 Subject: [PATCH] test(fusion_accounting_reports): coexistence behavior Mirrors Phase 1's coexistence test pattern. Verifies: - The coexistence group (group_fusion_show_when_enterprise_absent) exists and is referenceable - The reports engine model (fusion.report.engine) is always registered, regardless of Enterprise install state - The Financial Reports root menu requires the coexistence group - The Open Report... sub-menu (period picker wizard) is gated too Uses V19 group_ids attribute with a graceful fallback to groups_id for older runtime variants. Tests: 3 new (test_coexistence.py). Net 115 -> 118. Made-with: Cursor --- fusion_accounting_reports/__manifest__.py | 2 +- fusion_accounting_reports/tests/__init__.py | 1 + .../tests/test_coexistence.py | 39 +++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 fusion_accounting_reports/tests/test_coexistence.py diff --git a/fusion_accounting_reports/__manifest__.py b/fusion_accounting_reports/__manifest__.py index d57aacdd..d3ddf117 100644 --- a/fusion_accounting_reports/__manifest__.py +++ b/fusion_accounting_reports/__manifest__.py @@ -1,6 +1,6 @@ { 'name': 'Fusion Accounting Reports', - 'version': '19.0.1.0.34', + 'version': '19.0.1.0.35', 'category': 'Accounting/Accounting', 'summary': 'AI-augmented financial reports (P&L, balance sheet, trial balance, GL).', 'description': """ diff --git a/fusion_accounting_reports/tests/__init__.py b/fusion_accounting_reports/tests/__init__.py index adaa30d4..2bbce6ac 100644 --- a/fusion_accounting_reports/tests/__init__.py +++ b/fusion_accounting_reports/tests/__init__.py @@ -22,3 +22,4 @@ from . import test_pdf_export from . import test_xlsx_export from . import test_period_picker from . import test_migration_round_trip +from . import test_coexistence diff --git a/fusion_accounting_reports/tests/test_coexistence.py b/fusion_accounting_reports/tests/test_coexistence.py new file mode 100644 index 00000000..c47c7cf1 --- /dev/null +++ b/fusion_accounting_reports/tests/test_coexistence.py @@ -0,0 +1,39 @@ +"""Coexistence tests for fusion_accounting_reports. + +Mirrors Phase 1's coexistence test pattern: verifies the menu requires +the coexistence group, and the engine model is always available.""" + +from odoo.tests.common import TransactionCase, tagged + + +@tagged('post_install', '-at_install') +class TestReportsCoexistence(TransactionCase): + + def setUp(self): + super().setUp() + self.coex_group = self.env.ref( + 'fusion_accounting_core.group_fusion_show_when_enterprise_absent', + raise_if_not_found=False, + ) + self.assertIsNotNone(self.coex_group, "Coexistence group must exist") + + def test_engine_always_available(self): + """The engine is registered regardless of Enterprise install state.""" + self.assertIn('fusion.report.engine', self.env.registry) + + def test_menu_gated_by_coexistence_group(self): + menu = self.env.ref('fusion_accounting_reports.menu_fusion_reports_root', + raise_if_not_found=False) + if not menu: + self.skipTest("Menu not loaded") + menu_groups = getattr(menu, 'group_ids', None) or menu.groups_id + self.assertIn(self.coex_group, menu_groups, + "Reports root menu must require the coexistence group") + + def test_period_picker_wizard_gated_too(self): + menu = self.env.ref('fusion_accounting_reports.menu_fusion_reports_open', + raise_if_not_found=False) + if not menu: + self.skipTest("Menu not loaded") + menu_groups = getattr(menu, 'group_ids', None) or menu.groups_id + self.assertIn(self.coex_group, menu_groups)