diff --git a/odoo/addons/base/tests/test_base.py b/odoo/addons/base/tests/test_base.py index 5a45f00e95c..806a9f7fdea 100644 --- a/odoo/addons/base/tests/test_base.py +++ b/odoo/addons/base/tests/test_base.py @@ -526,3 +526,8 @@ class TestGroups(TransactionCase): # create a cycle and check a.implied_ids = d self.assertFalse(a._check_m2m_recursion('implied_ids')) + + def test_res_group_copy(self): + a = self.env['res.groups'].with_context(lang='en_US').create({'name': 'A'}) + b = a.copy() + self.assertFalse(a.name == b.name) diff --git a/odoo/models.py b/odoo/models.py index 005b2412f7e..5eeef77ef4e 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -4363,7 +4363,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): @@ -4372,6 +4372,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)