You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(spp_base_common): gate Apps menu on base.group_system via existing menuitem override (OP#951)
Earlier commits in this PR attempted the gating via spp_security: first
as an XML record override (e70a983), then as a post_init_hook
(cc11557). Both produced empty group_ids on a freshly installed DB —
verified on port 32774 with spp_security at 19.0.2.0.1.
Root cause: spp_base_common's views/main_view.xml already overrides
base.menu_management with its own <menuitem> (to set the OpenSPP web
icon). spp_base_common loads AFTER spp_security in the dep graph, and
in Odoo 19 a <menuitem> without an explicit `groups` attribute resets
group_ids on the target record. So any group_ids that spp_security's
hook or XML override writes earlier gets clobbered later by
spp_base_common's reload.
Fix: gate the menu where it's already declared. Add
`groups="base.group_system"` to the existing menuitem in
spp_base_common, and revert the spp_security gymnastics (version
bump, HISTORY entry, _gate_apps_menu hook, migration script).
System Admin is the only OpenSPP role that pulls in base.group_system
(via spp_user_roles.global_role_admin → Command.link(base.group_system)),
so this single attribute hides Apps from every other role and matches
the OP#951 audit's `Apps: no` rows.
Modules touched:
- spp_base_common: + groups attr on Apps menuitem; bump 19.0.2.0.0
→ 19.0.2.0.1 + HISTORY entry
- spp_security: revert version bump, drop _gate_apps_menu hook and
associated comment, no migration script needed
- fix(security): add `groups="base.group_system"` to the existing `<menuitem id="base.menu_management" />` override in `views/main_view.xml`. Out of the box the Apps top-level menu has no group restriction and is visible to every logged-in user, violating the OP#951 audit's `Apps: no` rows. The override here is the single authoritative declaration for this menu's attributes in the OpenSPP install (sequence, custom OpenSPP icon, and now group_ids); doing the gating anywhere upstream (e.g. a `post_init_hook` in `spp_security`) is unreliable because this `<menuitem>` reload re-writes the record without a `groups` attribute and resets `group_ids` to empty.
- fix(security): gate the Odoo-stock **Apps** top-level menu (`base.menu_management`) on `base.group_system` via a new `_gate_apps_menu` hook called from `post_init_hook`. Out of the box the menu had no `groups` restriction and was visible to every logged-in user, so the OP#951 audit's `Apps: no` rows were silently violated. System Admin is the only OpenSPP role that pulls in `base.group_system`, so this single Many2many write hides Apps from every other role without touching any individual role definition. Hook is idempotent and re-applies on every install/upgrade.
0 commit comments