[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
This commit is contained in:
Vo Minh Thu 2012-02-14 15:34:20 +01:00
parent 980e2825d5
commit 93f14f9135
1 changed files with 7 additions and 2 deletions

View File

@ -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 `<name> (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',