-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] Preserve all translated fields on v16 migration #131
base: master
Are you sure you want to change the base?
Conversation
4e4a801
to
28449d1
Compare
The table is renamed to _ir_translation and kept always. What translations are you trying to keep? Only entries with |
Merge to upgrade those Errors are killing me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
After a migration, you can see an upgrade report like this: It specifies that migrations may be wrong. However, in reality, all those are wrong because only the base language (usually en_US) is migrated. With this script, all langs are always migrated in all fields (declared by Odoo or not). Still, something may be wrong; but at least, most problems get auto-fixed now. |
Yes, you need to use That's the same mechanism we use in the standard upgrade script. We cannot do this for custom fields because we don't know if a field has a special What you could do is something like (beware: not tested!) for model in your_custom_models:
if model._auto and not model._abstract:
for field in model._fields.values():
if field.store and field.translate:
migrate, cleanup = _get_translation_upgrade_queries(cr, field)
# run the queries in migrate, and cleanup Side node: when |
11feadb
to
d8a5585
Compare
IIUC there shouldn't be an incompatibility between this PR and your suggestion, right? 🤔 This PR only improves the default value for those fields. If there's more magic involved, then you can still do that and get to the appropriate fix. |
This change is risky because it will interfere with all the battle tested machinery of the translations in 15->16 upgrade. Including PO loading, noupdate flags, etc. Also for specific scripts of some clients.
If you want to contribute an improvement I think it would be better to add something that could be used directly in @KangOl could you give some insight here please? |
d8a5585
to
f5871e7
Compare
I changed it according to your suggestion. Could you please review again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea looks correct, thanks!
I left some comments. In summary, IMO the important part of the suggestions is to allow to narrow down what needs to be updated as parameter(s) to the function.
upgradeci retry with always only base |
ae05ea4
to
182fe32
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nitpicks
3a035df
to
7127443
Compare
All attended. |
Could you please rebase your fork's branch in the latest master of this repo? The CIs are all red due to this. |
upgradeci retry |
Currently, the upgrade process preserves translations only for Odoo CE+EE fields. However, databases usually have more modules (or even custom fields) and those translations get lost when upgrading to Odoo 16. Running this script in a migrated database, all translated fields will inherit their translations in all languages. @moduon MT-7120 Co-authored-by: Alvaro Fuentes <[email protected]>
7127443
to
4475084
Compare
Rebased |
Currently, the upgrade process preserves translations only for Odoo CE+EE fields. However, databases usually have more modules (or even custom fields) and those translations get lost when upgrading to Odoo 16.
With this script, all translated fields will inherit their translations in all languages. Since it is executed in the
pre
phase ofbase
, it should be able to still find their_translation
table.@moduon MT-7120