Skip to content
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] migrate_translations_to_jsonb: avoid ir_translation terms cleanup #374

Conversation

chienandalu
Copy link
Member

We're making use of core's _get_translation_upgrade_queries which aside from provide the proper queries to upgrade the translated fields to the new json structure tries to cleanup the former ir_tanslation records.

In OpenUpgrade we try to keep historic info after migration so we're able to quickly react to possible inconsistencies.

cc @Tecnativa TT49615

env.cr, field
)
for query in migrate_queries:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this empty line

@chienandalu
Copy link
Member Author

There's a limitation here as the core method executes a query inside the method that expects the table ir_translation to be renamed as _ir_translation... so we we should do it in base pre-migration to be able to use it: https://github.com/OCA/OCB/blob/1e74b85c260fc0c6d15e7e4e13d9afcb9c2e9909/odoo/tools/translate.py#L1616-L1631

@pedrobaeza
Copy link
Member

I recommend then that this method renames the table before, and restores it after.

We're making use of core's `_get_translation_upgrade_queries` which
aside from provide the proper queries to upgrade the translated fields
to the new json structure tries to cleanup the former ir_tanslation
records.

In OpenUpgrade we try to keep historic info after migration so we're
able to quickly react to possible inconsistencies.

Besides that, we need to rename the `ir_translation` table if we want to
work with this method.

TT49615
@chienandalu chienandalu force-pushed the fix-migrate_translations_to_jsonb-delete-records branch from 7b2b12b to 743bf56 Compare June 18, 2024 11:21
@pedrobaeza
Copy link
Member

Now that I see the diff, why previous approach replacing inside the query didn't serve?

@chienandalu
Copy link
Member Author

See the code I linked in my previous comment. There's a query execution inside the method that we can't change

@pedrobaeza
Copy link
Member

OK, understood

@marielejeune FYI

@pedrobaeza pedrobaeza merged commit 74bb884 into OCA:master Jun 18, 2024
2 checks passed
@pedrobaeza pedrobaeza deleted the fix-migrate_translations_to_jsonb-delete-records branch June 18, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants