diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-06-15 18:44:16 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-06-15 18:44:16 +0200 |
| commit | 1b50c829ef383705647d0c2df7c89e9051ec40fb (patch) | |
| tree | 036df47c7cf94424f04d7ff9dac371fb79e2b1e4 /odoo/models.py | |
| parent | 0c2e018d4c416d0f47a3b64f1c28ce067dbab291 (diff) | |
| parent | 9713dc2e1f515b1260eaf26ec6bbfd5443f37d65 (diff) | |
[MERGE] forward port branch saas-15 up to 9713dc2e1f5
Diffstat (limited to 'odoo/models.py')
| -rw-r--r-- | odoo/models.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/odoo/models.py b/odoo/models.py index 518e0f7b859..b0b8361691a 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -3812,16 +3812,18 @@ class BaseModel(object): # 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 |
