From 93f14f91354f28ba9b85cecc5cc29fab55fcfcbc Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Tue, 14 Feb 2012 15:34:20 +0100 Subject: [PATCH] [FIX] product.copy(): do it in en_US: when implementing our own copy() method, and thus part of the copy_data() method, we should do it in a consistent way: copy_data() copy the name in en_US, so we should do it in en_US too. Otherwise we end up writing the name of the new product with a user-translated name. lp bug: https://launchpad.net/bugs/799655 fixed bzr revid: vmt@openerp.com-20120214143420-7c16betfwlwblgjo --- addons/product/product.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index 38c4d82..0d5fa31 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -661,11 +661,16 @@ class product_product(osv.osv): if context is None: context={} - product = self.read(cr, uid, id, ['name'], context=context) if not default: default = {} + + # Craft our own ` (copy)` in en_US (self.copy_translation() + # will do the other languages). + context_wo_lang = context.copy() + context_wo_lang.pop('lang', None) + product = self.read(cr, uid, id, ['name'], context=context_wo_lang) default = default.copy() - default['name'] = product['name'] + _(' (copy)') + default['name'] = product['name'] + ' (copy)' if context.get('variant',False): fields = ['product_tmpl_id', 'active', 'variants', 'default_code', -- 1.7.10.4