fix(spp_user_roles): remove _default_role_lines that copies roles from arbitrary users#163
Open
gonzalesedwin1123 wants to merge 1 commit into19.0from
Open
fix(spp_user_roles): remove _default_role_lines that copies roles from arbitrary users#163gonzalesedwin1123 wants to merge 1 commit into19.0from
gonzalesedwin1123 wants to merge 1 commit into19.0from
Conversation
…roles from arbitrary users The override tried base.default_user (removed in Odoo 19) then fell back to copying roles from the first user with any role lines — silently giving every new user an arbitrary set of roles. The upstream base_user_role OCA module already handles this correctly via an is_default boolean on res.users.role. Remove the dead overrides from spp_user_roles and spp_area, rewrite the test to verify the is_default mechanism, and fix tuple syntax to use Command.create() per Odoo 19 conventions. Closes #156
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 19.0 #163 +/- ##
==========================================
+ Coverage 71.19% 71.21% +0.01%
==========================================
Files 931 931
Lines 54694 54685 -9
==========================================
Hits 38942 38942
+ Misses 15752 15743 -9
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request removes the _default_role_lines method from the user models in spp_area and spp_user_roles. The logic for assigning default roles has been shifted, and the test suite has been updated to verify that default roles are now determined by an is_default flag on the roles themselves rather than being inherited from a template user. Additionally, the tests were refactored to use the Command helper for record creation. I have no feedback to provide.
emjay0921
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #156
_default_role_lines()override fromspp_user_rolesthat copied roles from an arbitrary user to all newly created users (thebase.default_userXMLID was removed in Odoo 19, so the fallback always fired)_default_role_lines()override fromspp_areathat enriched defaults with area data frombase.default_user(was a no-op since Odoo 19)base_user_roleOCA module already provides the correct mechanism via anis_defaultboolean onres.users.role— admins can mark specific roles to be auto-assigned to new usersis_defaultmechanism instead of the old buggy behavior(0, 0, {...})→Command.create()per Odoo 19 conventionsTest plan
spp_user_roles— 3/3 passspp_area— 50/50 passspp_approval— 128/128 pass (creates users, depends indirectly on role system)spp_programs— 579/579 pass (depends onspp_user_roles)ruff,ruff-format)