From: Vo Minh Thu Date: Tue, 14 Feb 2012 14:34:20 +0000 (+0100) Subject: [FIX] product.copy(): do it in en_US: X-Git-Tag: 6.1.0-web~69 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=93f14f91354f28ba9b85cecc5cc29fab55fcfcbc;p=odoo%2Fodoo.git [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 --- 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',