[FIX] base: rename user.groups_id references in domain/code#1
Open
dnplkndll wants to merge 63 commits into
Open
[FIX] base: rename user.groups_id references in domain/code#1dnplkndll wants to merge 63 commits into
dnplkndll wants to merge 63 commits into
Conversation
9559616 to
08c7b52
Compare
17bc71e to
a67dc15
Compare
08c7b52 to
459d5e6
Compare
459d5e6 to
76480c6
Compare
76480c6 to
144184c
Compare
144184c to
7eb12cd
Compare
d6a6be8 to
3d7e153
Compare
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3d7e153 to
5285643
Compare
[19.0][OU-ADD] crm: Migration scripts
It's missing in this version.
[19.0][OU-ADD] maintenance,stock_maintenance: Migration scripts
[19.0][OU-ADD] hr_maintenance: Nothing to do
[19.0][OU-ADD] survey: Migration scripts
[19.0][OU-ADD] website_profile: Migration scripts
when dependencies are added in same PR
[19.0][IMP] check_dependency: don't set blocked label when dependencies are added in same PR
…nstile [19.0][OU-ADD] website_cf_turnstile: Nothing to do
[19.0][MIG] event
[19.0][OU-ADD] event_product: Migration scripts
[19.0][OU-ADD] payment_stripe: Nothing to do
[19.0][OU-ADD] l10n_fr: Migration scripts
[19.0][OU-ADD] l10n_fr_account: Nothing to do
[19.0][OU-ADD] microsoft_outlook: Nothing to do
[19.0][OU-ADD] mail_bot_hr: Nothing to do
18's stored groups_id was the transitive group set; rewriting to group_ids (explicit only) silently narrowed membership tests in custom rules/filters/server actions. Map to all_group_ids (as 19 core did for its own rule data) and also rewrite the quoted LHS of res.users-scoped domains, which rename_field_references never touches.
…="Group By") Folds in the previously-stranded 19.0-fix-base-strip-search-view-removed-attrs work onto the base-owning branch (one folder = one branch). 19.0's stricter RelaxNG schema rejects `expand=` on <group>/<field> and `string="Group By"` on <group>; stored 18.0 search-view arch_db carrying them crashes view validation on first load. Strips them from ir_ui_view.arch_db (jsonb-aware, per-lang) in base pre-migration. Tests cover both <group expand=>/<field expand=> stripping and legitimate-attr preservation.
f60365a to
70f6429
Compare
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.
Context
This is an internal fork PR for testing before submitting upstream to OCA/OpenUpgrade. See OCA/OpenUpgrade#5363 for the 19.0 migration umbrella.
Problem
rename_fields()(from openupgradelib) renames the column onres_usersand quoted occurrences inir.filters.domain, but it does NOT process:ir.rule.domain_force— not touched at alluser.groups_id.idsthat appear inside Python-evaluated domain expressions / server-action codeConcretely, an
ir.rulesuch as:has its LHS migrated to
'group_ids'but the RHS is left untouched. After migration, any view that triggers the rule crashes at runtime with:(
groups_idwas renamed togroup_idsin Odoo 19; Odoo core then promotesuser.group_idstouser.all_group_idsfor the implied-groups check, but the sourcegroups_idreference has to be rewritten first.)Fix
Add a post-step in
base/19.0.1.3/pre-migration.pythat does a word-boundary regex replace ofuser.groups_id→user.group_idsin:ir_rule.domain_forceir_filters.domainir_act_server.codeHow tested
Migrated a real Ledo Enterprises prod 18.0 backup (168 installed modules) to 19.0:
Without the fix — login page returned HTTP 500:
AttributeError("'res.users' object has no attribute 'groups_id'") while evaluating "['|', ('group_ids', '=', False), ('group_ids', 'in', user.groups_id.ids)]". The offending record wasir.rule#345"Website menu: group_ids".With the fix — re-restored prod backup, manually set
ir.rule#345.domain_forceback to the brokenuser.groups_idform to simulate a stock-restore scenario, then ran the migration. The pre-migration's regex_replace fired (visible in logs), the ir.rule was rewritten touser.group_ids, and Odoo core then upgraded it further to the canonicaluser.all_group_ids.Migration also exercised:
ir_filtersandir_act_serverqueries; no false matches in the test corpus.Test plan
AttributeErroronres.users.groups_idir.rule.domain_forcecontaininguser.groups_id.idsis rewrittenBranch: 19.0-fix-user-groups-id-rename
Tracking lab: ledoent/openupgrade-lab —
scripts/restore-prod.shcarries an SQL fallback for unpatched OpenUpgrade copies.