fix(fusion_accounting_migration): add menu + tighten safety-guard test coverage

Addresses code review feedback on Task 17:
- Add menuitem so 'Fusion Accounting -> Migrate from Enterprise' is reachable
  (the UserError guidance now actually works). Placed at top level since
  parenting under fusion_accounting_ai.menu_fusion_accounting_root would
  require adding that module as a hard dep, which is wrong semantically
  (migration should not require AI). Both menuitems carry the admin group
  so the menu stays hidden from users who can't open the wizard anyway.
- Update the UserError wording to "Fusion Accounting -> Migrate from
  Enterprise" (no longer "Settings -> ...") to match the actual menu
  location; 'migration' is preserved per the test's assertIn check.
- Add skipTest guard to test_uninstall_not_blocked_when_migration_completed
  so it doesn't pass vacuously on Community-only CI (the guard's
  `if not installed: continue` would otherwise return True regardless of
  the flag value, giving a false green).
- Move GUARDED_MODULES import to top of wizards/migration_wizard.py
  (no circular-import risk -- models/ir_module_module.py doesn't import
  from wizards/).
- Expand docstrings on button_immediate_uninstall and module_uninstall
  overrides to note they may both fire in a single UI uninstall call
  and that the guard is idempotent (pure read + raise).

Made-with: Cursor
This commit is contained in:
gsinghpal
2026-04-19 00:51:32 -04:00
parent db90b1ad5b
commit de71a61a8b
4 changed files with 50 additions and 8 deletions

View File

@@ -10,6 +10,8 @@ the bank-rec verification check. Phase 6 will add asset migration, etc.
from odoo import _, api, fields, models
from ..models.ir_module_module import GUARDED_MODULES
class FusionMigrationWizard(models.TransientModel):
_name = "fusion.migration.wizard"
@@ -34,7 +36,6 @@ class FusionMigrationWizard(models.TransientModel):
@api.depends_context('uid')
def _compute_detected(self):
Mod = self.env['ir.module.module'].sudo()
from ..models.ir_module_module import GUARDED_MODULES
installed = Mod.search([
('name', 'in', list(GUARDED_MODULES)),
('state', '=', 'installed'),

View File

@@ -25,4 +25,22 @@
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<!--
Top-level "Fusion Accounting" menu so the UserError guidance
("Fusion Accounting -> Migrate from Enterprise") is actually reachable.
Placed at top level (no parent) because the migration is a one-time
admin task; making it visible during switchover is the point.
`groups` hides the menu from non-admins (mirroring the ACL on the wizard).
-->
<menuitem id="menu_fusion_migration_root"
name="Fusion Accounting"
sequence="95"
groups="fusion_accounting_core.group_fusion_accounting_admin"/>
<menuitem id="menu_fusion_migration_wizard"
name="Migrate from Enterprise"
parent="menu_fusion_migration_root"
action="action_fusion_migration_wizard"
sequence="10"
groups="fusion_accounting_core.group_fusion_accounting_admin"/>
</odoo>