from odoo.tests.common import TransactionCase, tagged @tagged('post_install', '-at_install') class TestPostMigration(TransactionCase): """Verify ir_model_data ownership transferred from fusion_accounting to fusion_accounting_ai.""" def test_no_orphan_ir_model_data_in_old_module(self): """No fusion-related model/view/data record should still claim module='fusion_accounting'. After Phase 0, fusion_accounting is the meta-module and owns no records. Every fusion.* model/view/data record should be owned by a sub-module (fusion_accounting_ai, fusion_accounting_core, fusion_accounting_migration). """ orphans = self.env['ir.model.data'].search([ ('module', '=', 'fusion_accounting'), ('name', 'like', '%'), ]) # The meta-module legitimately may own zero records. Anything found here # is an orphan from the pre-Phase-0 layout. self.assertFalse( orphans, f"Found {len(orphans)} ir_model_data rows still owned by fusion_accounting " f"(should be owned by sub-modules). Examples: " f"{[(r.module, r.name) for r in orphans[:5]]}" ) def test_known_xml_ids_resolve_via_new_module(self): """Spot-check that key xml-ids are reachable under the new module name.""" # Sessions model ref = self.env.ref('fusion_accounting_ai.model_fusion_accounting_session', raise_if_not_found=False) self.assertTrue(ref, "fusion_accounting_ai.model_fusion_accounting_session should resolve") # Security group # (this lives in _core after Task 12 — adapt assertion when Task 12 completes)