diff options
| author | Martin Trigaux <mat@odoo.com> | 2019-02-26 16:05:59 +0000 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2019-02-28 07:33:03 +0000 |
| commit | d855e3911fa40472f471439c5b3d78e3f7f493a8 (patch) | |
| tree | cf73dabf7ab975ef8a398586c856a9ebd6cb15b9 /addons/web/static/src/js/views/basic/basic_controller.js | |
| parent | 686e6e10cebb42e6434f6865ae9a9e227d92e745 (diff) | |
[FIX] orm: backport of 06d73eab62 to 11.0
[FIX] models: do not erase master version
For a translated field with a callable method (e.g. xml_translate), when
modifying the value of this field in another language than en_US, the master
version was lost.
Before this patch:
>>> record.arch = "<h1>Title</h1>"
>>> record.with_context(lang='fr_FR').arch = "<h1>Titre</h1>"
>>> record.with_context(lang='fr_FR').arch
"<h1>Titre</h1>"
>>> record.arch
"<h1>Titre</h1>" # lost English version
After this patch:
>>> record.arch = "<h1>Title</h1>"
>>> record.with_context(lang='fr_FR').arch = "<h1>Titre</h1>"
>>> record.with_context(lang='fr_FR').arch
"<h1>Title</h1>" # write had no effect
>>> record.arch
"<h1>Title</h1>"
When modifying a translated HTML field in English, a matching to detect the
difference and avoid losing the translations is done.
This is not supported for update in another language.
The main reason is the difficulty to detect changes in the architecture.
To update translations, the supported way is to go to the list of translations
and update them there.
Before this patch, the given value in another language was given to the SQL
query and made an update in database:
if single_lang or not (has_translation and field.translate is True)
-> True or not (True and False) -> True
If a field is callable, it should also be ignored, the same way than
translate=True fields
opw-1887162
closes odoo/odoo#31451
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_controller.js')
0 files changed, 0 insertions, 0 deletions
