Skip to content

spp_user_roles: role_ids_stored list-view workaround may be redundant after OCA base_user_role fix (#428) #511

Description

@gonzalesedwin1123

Follow-up from #508 / OCA server-backend #428, kept out of #508 deliberately (that PR was a CI-red hotfix and only renamed the xpath).

Background

spp_user_roles carries a stored Many2many on res.users:

# Stored version of base_user_role.user_role_ids for list view display
# The base_user_role One2many computed field doesn't display in list views
role_ids_stored = fields.Many2many(
    comodel_name="res.users.role",
    compute="_compute_role_ids_stored",
    store=True,
    groups="base.group_erp_manager",
)

and views/user.xml replaces base_user_role's user_role_ids column in view_res_users_tree_inherit with it (priority 99). The stated reason is that the OCA computed field did not render in the users list.

OCA/server-backend #428 ("[19.0][FIX] base_user_role: Cannot see User Roles", merged 2026-09-04, cc051ce6) is a fix for exactly that symptom: it renamed role_idsuser_role_ids, reworked the compute, and the OCA list view now shows user_role_ids with many2many_tags directly. So the workaround may be papering over a bug that no longer exists.

To check

  1. On a 19.0 build with current OCA head, temporarily drop view_res_users_tree_inherit_spp_user_roles and confirm the Roles column renders (and updates when a role line is disabled / expires) from OCA's own user_role_ids.
  2. Confirm nothing else reads role_ids_stored. git grep on 19.0 finds it only in spp_user_roles/models/user.py and spp_user_roles/views/user.xml; check customer overlays too.
  3. Note the OCA field is a computed One2many, not stored, so it cannot be searched/grouped on in the list. If we rely on search-by-role anywhere (filters, exports), the stored field still earns its place and this issue should be closed as "keep".

If it is redundant

  • Remove the field, its compute, and the list-view override; keep the form inherit and the hide-role-column view.
  • Migration to drop the res_users_res_users_role_rel-style m2m table (check the actual relation name) so upgraded databases do not keep an orphan table.
  • Bump spp_user_roles (currently 19.0.2.0.2), add HISTORY entry.

Small, self-contained PR; not urgent. Depends on nothing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions