Open Marrieta99 opened 3 months ago
I've been able to reproduce this bug in Odoo v16 Enterprise Edition as well. After further investigation, I've identified some additional details about the issue:
The issue appears to be linked with the recalculation of the User Types / Internal User group. When the last role containing the User Types / Internal User group is removed (even temporarily without saving), the user type is reset. This reset causes the user's notification type to revert to its default value (email).
This behavior is consistent with normal Odoo operations regarding user types. When all roles containing the Internal User group are removed, even momentarily, Odoo recalculates the user type, which triggers a reset of user preferences, including the notification type.
To prevent this reset from occurring, it's crucial to always maintain at least one role that contains the User Types / Internal User group for each user. Here's a step-by-step process to safely modify roles without triggering the reset:
This approach ensures that the Internal User group is never completely removed during the process, avoiding the recalculation of the user type.
Create a separate user group dedicated to containing only the User Types / Internal User group. Always keep this group assigned to the user. This allows you to freely add, remove, or replace other roles without forcing a recalculation of the user type, thus avoiding the reset of user communication preferences.
Module
base_user_role
Describe the bug
When a user's roles are altered,
To Reproduce
Affected versions: V17 at least, have not tried it in other versions
Steps to reproduce the behavior:
Expected behavior User's notification handling preferences shouldn't change, regardless of their roles
Additional context Found this bug in my Odoo.sh instance. Version is 17.0+e (Enterprise Edition) The bug was found in my productive (main) branch, and successfully replicated in a fresh dev database with only the base_user_role module installed