[17.0][FIX] base_user_role : fix tests to group groups into a role
Hi @jcdrubay, @sebalix, @novawish, some modules you are maintaining are being modified, check this out!
Add force group recalculation in role assignment tests to handle group synchronization issues that occur when base_user_role and auditlog modules are both installed. Without forcing updates, tests fail in odoo.sh and OCA CI environments due to group assignment mismatches.
Force parameter in set_groups_from_roles() ensures proper group synchronization regardless of auditlog's presence. No issues occur when base_user_role runs standalone.
Fix applied to all role assignment test methods to maintain consistent behavior across test scenarios.
Hello @pedrobaeza Can you review this PR? Thank you
I can't say about this one.
@pedrobaeza Do you know how to ping? You made the "mistake" to help me once at last OCA days but I'm more then willing to spread my pings.
You can ping module maintainers. Formally, the PR shouldn't change the module version (it's done by the bot), and that way, you clean it without the README changes.
There are fixes which have been done for other Odoo versions, and we should probably try to port them first (the use of sorted for instance has been fixed in 15.0 by using set). I'm trying to port some of the PRs done in 15.0 to 17.0 first:
- https://github.com/OCA/server-backend/pull/335
@mb-ife @ng-ife , can you check if the mentioned PR above fixed your issues? And/or adapt your PR if it remains fixes to apply
Hello @sebalix , Thanks for the updates , we have issues mainly with testing we'll double check again and give you feedback.
I also ported missing commits for 16.0 and 18.0 there:
- https://github.com/OCA/server-backend/pull/336
- https://github.com/OCA/server-backend/pull/337
Hello @sebalix
After checking the new version it solve for us this issue here with the sorted groups https://github.com/OCA/server-backend/issues/327 , but still have an issue when combined with auditlog module https://github.com/OCA/server-backend/issues/321 , the current PR is currently solving this at the moment.
@mb-ife Ok, thanks for the feedback. What I do not like the way it is fixed here, is that it doesn't really test the feature as it should work: we update the roles on the user, and the call to set_groups_from_roles is implicit (we should not have to call it manually in tests) and we should get the expected results.
So it's like hidding the issue, without explaining why it behaves this way: we probably have something else to fix in the design (in auditlog or base_user_role, or if not, a comment explaining the reason why we are taking this shortcut).
Indeed, if this is an issue in combination with auditlog, it's the issue that needs fixing, not the test. Can you tell us how to reproduce the issue?
Hello @sebalix, @StefanRijnhart
After investigating the test failure, I realized that simply adding a manual call to set_groups_from_roles(force=True) is not an adequate solution to the underlying issue. When the auditlog and base_user_role modules are installed together, the automatic group assignment for roles does not work as expected.
To reproduce we only need to run a test with base_user_role and auditlog on the same folder. This is happening on Odoo 16 as well, and you can see a similar issue here https://github.com/OCA/server-backend/issues/321. The error is triggered on OCA CI as well as on Odoo.sh.
The easiest approach seems to be forcing the groups update in base_user_role. I would appreciate a second opinion on this approach.
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.