Skip to content

[FIX] base_user_role: Cannot see User Roles in list view, even though the user has roles in form view#428

Open
namtnt wants to merge 1 commit intoOCA:19.0from
komit-consulting:19.0-fix_base_user_role
Open

[FIX] base_user_role: Cannot see User Roles in list view, even though the user has roles in form view#428
namtnt wants to merge 1 commit intoOCA:19.0from
komit-consulting:19.0-fix_base_user_role

Conversation

@namtnt
Copy link

@namtnt namtnt commented Mar 4, 2026

Summary
Currently, native Odoo already defines a role_ids field (m2m). This overrides the role_ids field (o2m) from the base_user_role module, which causes the User Roles field to be empty in the User list view.

Changes
Renamed role_ids field to user_role_ids.

Reproduce:
Create a User and set a role for the User
image

Back to User list view -> User Roles is empty
image

@OCA-git-bot
Copy link
Contributor

Hi @novawish, @sebalix, @jcdrubay,
some modules you are maintaining are being modified, check this out!

@cuongnmtm
Copy link

@namtnt could you please squash the commits? And the FIX/IMP commit msg should not has version prefix, so that we can pw-port down-port it w/o the need to update commit msg.

user_role_ids = fields.One2many(
comodel_name="res.users.role",
string="User Roles",
string="Roles",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to change this. Do you have a good reason for this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this change to fix this warning WARNING odoo odoo.addons.base.models.ir_model: Two fields (user_role_ids, role_ids) of res.users() have the same label: User Roles. [Modules: base_user_role and mail]

@namtnt namtnt changed the title [19.0][FIX] base_user_role: Cannot see User Roles in list view, even though the user has roles in form view [FIX] base_user_role: Cannot see User Roles in list view, even though the user has roles in form view Mar 4, 2026
Copy link
Member

@amh-mw amh-mw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review only. LGTM.

@namtnt namtnt force-pushed the 19.0-fix_base_user_role branch from b75e07b to 2a4cfeb Compare March 5, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants