← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-734191-ron into lp:openobject-addons

 

Rohan Nayani(openerp) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-734191-ron into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #734191 in OpenERP Addons: "translation name in product.form after duplication"
  https://bugs.launchpad.net/openobject-addons/+bug/734191

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-734191-ron/+merge/55121

https://launchpad.net/bugs/734191
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-734191-ron/+merge/55121
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-734191-ron.
=== modified file 'product/product.py'
--- product/product.py	2011-03-09 18:41:27 +0000
+++ product/product.py	2011-03-28 11:15:44 +0000
@@ -609,17 +609,19 @@
     def copy(self, cr, uid, id, default=None, context=None):
         if context is None:
             context={}
-
-        product = self.read(cr, uid, id, ['name'], context=context)
+        context_wo_lang = context.copy()
+        if 'lang' in context:
+            del context_wo_lang['lang']
+        product = self.read(cr, uid, id, ['name'], context=context_wo_lang)
         if not default:
             default = {}
         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',
                     'price_margin', 'price_extra']
-            data = self.read(cr, uid, id, fields=fields, context=context)
+            data = self.read(cr, uid, id, fields=fields, context=context_wo_lang)
             for f in fields:
                 if f in default:
                     data[f] = default[f]


Follow ups