Anup(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.0-opw_bug-734191-ach into
lp:openobject-addons/6.0.
Requested reviews:
Jay Vora (OpenERP) (jvo-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/6.0-opw_bug-734191-ach/+merge/56116
Hello,
The issue has been fixed by this solution. Due to context the German was
being copied in the orignal data or as an english translation. It's fixed.
The translations were not also being copied properly and that was also the
reason for not having the correct results in different languages.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw_bug-734191-ach/+merge/56116
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.0-opw_bug-734191-ach.
=== modified file 'product/product.py'
--- product/product.py 2011-03-10 09:52:25 +0000
+++ product/product.py 2011-04-04 09:37:32 +0000
@@ -607,15 +607,32 @@
return res
+ def copy_translations(self, cr, uid, old_id, new_id, context=None):
+ # Copyitng Translations with (copy)
+ if context is None:
+ context = {}
+ super(product_product,self).copy_translations(cr, uid, old_id, new_id, context=context)
+ trans_obj = self.pool.get('ir.translation')
+ trans_ids = trans_obj.search(cr,uid,[('res_id','=',new_id),('name','=','product.template,name')])
+ trans_records = trans_obj.read(cr,uid,trans_ids,['src','value','lang'])
+ for trans_rec in trans_records:
+ context['lang'] = trans_rec['lang']
+ trans_rec['src'] += ' (copy)'
+ trans_rec['value'] += _(' (copy)')
+ tr_id = trans_rec['id']
+ del trans_rec['id']
+ trans_obj.write(cr,uid,tr_id,trans_rec)
+
def copy(self, cr, uid, id, default=None, context=None):
if context is None:
context={}
+ context['lang'] = 'en_US'
product = self.read(cr, uid, id, ['name'], context=context)
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',
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp