summaryrefslogtreecommitdiff
path: root/odoo/models.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-07-04 14:40:20 +0200
committerChristophe Simonis <chs@odoo.com>2017-07-04 14:40:20 +0200
commit10cb34bcacc0983cdab722e528d413a996df3a7b (patch)
tree749977ed99f5895080eac3d0fd842033eb276b7b /odoo/models.py
parent81d0bfa4738c5563a26df5cd666ef895cd59d3d0 (diff)
parent97258040d80f3435b6d461de35f86a615ee2b106 (diff)
[MERGE] forward port branch saas-14 up to 97258040d80
Diffstat (limited to 'odoo/models.py')
-rw-r--r--odoo/models.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/odoo/models.py b/odoo/models.py
index 7dbeaaad68f..4e76728ed8f 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -3814,7 +3814,7 @@ class BaseModel(object):
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:
+ if old.env.lang and callable(field.translate):
# 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):
@@ -3823,6 +3823,7 @@ class BaseModel(object):
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:
+ vals['source'] = old_wo_lang[name]
# the value should be the new value (given by copy())
vals['value'] = new_val
Translation.create(vals)