odoo/odoo#195170
Created by fw-bot
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:master-saas-17.2-disable-upgrade-xml-typofix-cwg-Mpbf-fw
- head
- 189e86ecc1b1945da09760f376bd16fb3b8c6cec
- merged
- 9 months ago by Framework (ORM), Chong Wang (cwg)
| odoo/odoo | |
|---|---|
| saas-17.2 | #194816 |
| saas-17.4 | #195032 |
| 18.0 | #195055 |
| saas-18.1 | #195079 |
| saas-18.2 | |
| saas-18.3 | |
| saas-18.4 | |
| 19.0 | |
| master | #195170 |
[FW][FW][FIX] core: inherit translations better when upgrade
Before:
The typofix feature treats terms in the old and new values with similar text content as the same term, migrating the translations of the old term to the new term.
For example
The old value has the mapping:
'Draft': 'Brouillon'
The new value contains the term:
'<span invisible="name or name_placeholder or quick_edit_mode">Draft</span>'
Since the old term and the new term share the same text content, 'Draft', after write, the new term reuses the old translation of 'Draft'. However, the translation 'Brouillon' is always visible, unlike its en_US counterpart.
This behavior is acceptable in non-upgrade mode because the user writes the en_US value and is responsible for verifying translations afterward. However, it is problematic during upgrades because users cannot easily identify which records have changed and need to be rechecked.
After:
The translation inheritance behavior can be described as below Translations can be inherited after write from old terms to new terms which share the very close text contents
1. when write in production mode, text contents for translation terms are more important than the HTML/XML structures of them, and the old term translations should be remained as much as possible. Because
* the writing user is responsible to recheck all translations after write.
* it is easier for the writing user to copy technical HTML/XML structures than translate text contents for a language they may not know.
* the feature can also be used as typofix when the only small diff is the text content
2. when write in upgrade time, the HTML/XML structure is more important than the text content, and the new term structure should be remained as much as possible. Because
* HTML/XML structures might be changed a lot after upgrade, which may contain behavior relevant diff (e.g. invisible), even if text contents are not changed.
* users have no idea which records' values are changed during upgrade and are hard to recheck their translations.
* new terms are highly likely to be correctly translated in the latest po files which will be imported during upgrade.
* the typofix feature can still be remained when the only small diff is the text content
Based on the above feature analysis, we use the below new strategy
1. translations can be inherited only if the old source term and the new source term share the same HTML/XML structure
2. translations can be inherited only if the old translation term and the new source term share the same HTML/XML structure
3. when translations are inherited, MODIFIER_ATTRS will be synchronized with the new source term, other attributes will be copied from the source term if available.
Forward-Port-Of: #194181
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr