Conversation
Contributor
Contributor
Author
|
upgradeci retry with always only base |
aj-fuentes
reviewed
Oct 31, 2025
aj-fuentes
left a comment
Contributor
There was a problem hiding this comment.
Better check if there isn't any xmlid for the field under the available modules (standard_modules usual trick)
jjmaksoud
force-pushed
the
master-rename-m2m-rels-maji
branch
2 times, most recently
from
October 31, 2025 14:59
eef47dd to
220fed7
Compare
aj-fuentes
reviewed
Nov 4, 2025
jjmaksoud
force-pushed
the
master-rename-m2m-rels-maji
branch
from
August 27, 2026 17:05
220fed7 to
a25ae4f
Compare
KangOl
requested changes
Aug 28, 2026
jjmaksoud
force-pushed
the
master-rename-m2m-rels-maji
branch
from
August 28, 2026 08:15
a25ae4f to
da2dbe1
Compare
KangOl
reviewed
Aug 28, 2026
jjmaksoud
force-pushed
the
master-rename-m2m-rels-maji
branch
from
September 7, 2026 13:29
da2dbe1 to
1cb75bf
Compare
When renaming a model and updating related m2m fields, the relation table and its columns are renamed but only manual fields meta data is updated, assuming that base fields will be updated when the module loads. The custom modules meta data should also be updated if the tables were updated.
jjmaksoud
force-pushed
the
master-rename-m2m-rels-maji
branch
from
September 17, 2026 08:50
1cb75bf to
24a74e0
Compare
KangOl
reviewed
Sep 17, 2026
Comment on lines
-1722
to
+1732
| UPDATE ir_model_fields | ||
| UPDATE ir_model_fields f | ||
| SET relation_table = %s | ||
| WHERE relation_table = %s | ||
| AND state = 'manual' | ||
| FROM ir_model_data d | ||
| WHERE f.relation_table = %s | ||
| AND ( | ||
| f.state = 'manual' | ||
| OR (d.model = 'ir.model.fields' | ||
| AND d.res_id = f.id | ||
| AND d.module NOT IN %s) | ||
| ) |
Contributor
There was a problem hiding this comment.
This will update row multiple times.
Better use a CTE.
Suggested change
| UPDATE ir_model_fields | |
| UPDATE ir_model_fields f | |
| SET relation_table = %s | |
| WHERE relation_table = %s | |
| AND state = 'manual' | |
| FROM ir_model_data d | |
| WHERE f.relation_table = %s | |
| AND ( | |
| f.state = 'manual' | |
| OR (d.model = 'ir.model.fields' | |
| AND d.res_id = f.id | |
| AND d.module NOT IN %s) | |
| ) | |
| WITH _f AS ( | |
| SELECT f.id | |
| FROM ir_model_fields f | |
| LEFT JOIN ir_model_data d | |
| ON d.model = 'ir.model.fields' | |
| AND d.res_id = f.id | |
| AND d.module NOT IN %s | |
| WHERE f.relation_table = %s | |
| AND (d.id IS NOT NULL OR f.state = 'manual') | |
| GROUP BY f.id | |
| ) | |
| UPDATE ir_model_fields | |
| SET relation_table = %s | |
| FROM _f | |
| WHERE _f.if = ir_model_fields.id |
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.
When renaming a model and updating related m2m fields, the relation table and its columns are renamed but only manual fields meta data is updated, assuming that base fields will be updated when the module loads.
The custom modules meta data should also be updated if the tables were updated.
upg-3176133