test(fusion_accounting_assets): coexistence behavior

Made-with: Cursor
This commit is contained in:
gsinghpal
2026-04-19 20:16:30 -04:00
parent 02885108f2
commit 2ee341316c
2 changed files with 39 additions and 0 deletions

View File

@@ -25,3 +25,4 @@ from . import test_partial_sale_wizard
from . import test_depreciation_run_wizard
from . import test_migration_round_trip
from . import test_audit_report
from . import test_coexistence

View File

@@ -0,0 +1,38 @@
"""Coexistence tests: fusion_accounting_assets menu only visible when
Enterprise account_asset is NOT installed."""
from odoo.tests.common import TransactionCase
from odoo.tests import tagged
@tagged('post_install', '-at_install')
class TestAssetsCoexistence(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):
"""Engine is registered regardless of Enterprise install state."""
self.assertIn('fusion.asset.engine', self.env.registry)
def test_menu_gated_by_coexistence_group(self):
menu = self.env.ref('fusion_accounting_assets.menu_fusion_assets_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,
"Asset root menu must require the coexistence group")
def test_categories_menu_gated(self):
menu = self.env.ref('fusion_accounting_assets.menu_fusion_asset_categories',
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)