summaryrefslogtreecommitdiff
path: root/odoo/models.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-06-15 18:46:47 +0200
committerChristophe Simonis <chs@odoo.com>2017-06-15 18:46:47 +0200
commited2ddeccdfaac46acb4d4bfbdac5f1b570f0829c (patch)
tree5d0c41f089c8deddd753a7ec61217ee33d007451 /odoo/models.py
parent156e07f6387b3e2b8915b1bd8624195d7110c3f5 (diff)
parent1b50c829ef383705647d0c2df7c89e9051ec40fb (diff)
[MERGE] forward port branch saas-16 up to 1b50c829ef3
Diffstat (limited to 'odoo/models.py')
-rw-r--r--odoo/models.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/odoo/models.py b/odoo/models.py
index 71040650173..e3e90a12975 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -3802,16 +3802,18 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
# for translatable fields we copy their translations
trans_name, source_id, target_id = get_trans(field, old, new)
domain = [('name', '=', trans_name), ('res_id', '=', source_id)]
+ new_val = new_wo_lang[name]
+ if old.env.lang:
+ # the new value *without lang* must be the old value without lang
+ new_wo_lang[name] = old_wo_lang[name]
for vals in Translation.search_read(domain):
del vals['id']
del vals['source'] # remove source to avoid triggering _set_src
del vals['module'] # duplicated vals is not linked to any module
vals['res_id'] = target_id
if vals['lang'] == old.env.lang and field.translate is True:
- # 'source' to force the call to _set_src
- # 'value' needed if value is changed in copy(), want to see the new_value
- vals['source'] = old_wo_lang[name]
- vals['value'] = new_wo_lang[name]
+ # the value should be the new value (given by copy())
+ vals['value'] = new_val
Translation.create(vals)
@api.multi