From 3b5cf5d56c20a5793b8890876a032bb0f008f7bf Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 25 Nov 2013 12:57:27 +0100 Subject: [PATCH] [FIX] translations: fix tests to adapt to new duplication behaviour and remove context hack in copy_data (translations are now fully handled in copy_translation) bzr revid: mat@openerp.com-20131125115727-o9oejao1ziagqti1 --- openerp/addons/base/tests/test_base.py | 4 ++-- openerp/osv/orm.py | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/openerp/addons/base/tests/test_base.py b/openerp/addons/base/tests/test_base.py index a7df2a5bb27..1ca66f57943 100644 --- a/openerp/addons/base/tests/test_base.py +++ b/openerp/addons/base/tests/test_base.py @@ -340,10 +340,10 @@ class test_translation(common.TransactionCase): self.new_fr_cat_id = self.res_category.copy(cr, uid, self.cat_id, default={'name': 'Clients (copie)'}, context={'lang':'fr_FR'}) no_context_cat = self.res_category.browse(cr, uid, self.new_fr_cat_id) - self.assertEqual(no_context_cat.name, 'Clients (copie)', "Duplication with default value not applied") + self.assertEqual(no_context_cat.name, 'Customers', "Duplication erased original untranslated value") fr_context_cat = self.res_category.browse(cr, uid, self.new_fr_cat_id, context={'lang':'fr_FR'}) - self.assertEqual(fr_context_cat.name, 'Clients', "Did not found translation for initial value") + self.assertEqual(fr_context_cat.name, 'Clients (copie)', "Did not used default value for translated value") if __name__ == '__main__': diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 1a81a18bbd8..019683905e9 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -4930,10 +4930,7 @@ class BaseModel(object): else: default['state'] = self._defaults['state'] - context_wo_lang = context.copy() - if 'lang' in context: - del context_wo_lang['lang'] - data = self.read(cr, uid, [id,], context=context_wo_lang) + data = self.read(cr, uid, [id,], context=context) if data: data = data[0] else: