"""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)