[FIX] fixed a bug in copy_data: it now copies the original (not translated) field value as the source value

bzr revid: jvo@tinyerp.com-20100512143348-2sislcjnilge4nci
This commit is contained in:
Jay (Open ERP) 2010-05-12 20:03:48 +05:30
parent 7b881e314f
commit 89e7934e7d
1 changed files with 11 additions and 10 deletions

View File

@ -3736,9 +3736,9 @@ class orm(orm_template):
:return: dictionary containing all the field values :return: dictionary containing all the field values
""" """
if not context: if context is None:
context = {} context = {}
if not default: if default is None:
default = {} default = {}
if 'state' not in default: if 'state' not in default:
if 'state' in self._defaults: if 'state' in self._defaults:
@ -3747,7 +3747,11 @@ class orm(orm_template):
else: else:
default['state'] = self._defaults['state'] default['state'] = self._defaults['state']
data = self.read(cr, uid, [id], context=context)[0] context_wo_lang = context
if 'lang' in context:
del context_wo_lang['lang']
data = self.read(cr, uid, [id], context=context_wo_lang)[0]
fields = self.fields_get(cr, uid, context=context) fields = self.fields_get(cr, uid, context=context)
trans_data=[] trans_data=[]
for f in fields: for f in fields:
@ -3782,17 +3786,14 @@ class orm(orm_template):
trans_obj = self.pool.get('ir.translation') trans_obj = self.pool.get('ir.translation')
#TODO: optimize translations #TODO: optimize translations
trans_name=''
for f in fields: for f in fields:
trans_flag=True trans_name = ''
if f in self._columns and self._columns[f].translate: if f in self._columns and self._columns[f].translate:
trans_name=self._name+","+f trans_name = self._name+","+f
elif f in self._inherit_fields and self._inherit_fields[f][2].translate: elif f in self._inherit_fields and self._inherit_fields[f][2].translate:
trans_name=self._inherit_fields[f][0]+","+f trans_name = self._inherit_fields[f][0] + "," + f
else:
trans_flag=False
if trans_flag: if trans_name:
trans_ids = trans_obj.search(cr, uid, [ trans_ids = trans_obj.search(cr, uid, [
('name', '=', trans_name), ('name', '=', trans_name),
('res_id','=',data['id']) ('res_id','=',data['id'])