diff --git a/fusion_accounting_followup/tests/__init__.py b/fusion_accounting_followup/tests/__init__.py index 88f9ca6e..e78d0895 100644 --- a/fusion_accounting_followup/tests/__init__.py +++ b/fusion_accounting_followup/tests/__init__.py @@ -19,3 +19,4 @@ from . import test_followup_full_flow from . import test_performance_benchmarks from . import test_batch_followup_wizard from . import test_migration_round_trip +from . import test_coexistence diff --git a/fusion_accounting_followup/tests/test_coexistence.py b/fusion_accounting_followup/tests/test_coexistence.py new file mode 100644 index 00000000..443b05ca --- /dev/null +++ b/fusion_accounting_followup/tests/test_coexistence.py @@ -0,0 +1,37 @@ +"""Coexistence tests: fusion_accounting_followup menu only visible when +Enterprise account_followup is NOT installed.""" + +from odoo.tests.common import TransactionCase +from odoo.tests import tagged + + +@tagged('post_install', '-at_install') +class TestFollowupCoexistence(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): + self.assertIn('fusion.followup.engine', self.env.registry) + + def test_menu_gated_by_coexistence_group(self): + menu = self.env.ref('fusion_accounting_followup.menu_fusion_followup_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, + "Followup root menu must require the coexistence group") + + def test_levels_menu_gated(self): + menu = self.env.ref('fusion_accounting_followup.menu_fusion_followup_levels', + 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)