c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #27245
[Bug 801897] [NEW] Translations in Form and Tree View not work
Public bug reported:
Translation in Form and Tree View not work in latest Trunk, the Problem
is the fields_get Method on Line 1265 in orm.py
Here ist the Bugfix:
def fields_get(self, cr, user, allfields=None, context=None, write_access=True):
""" Returns the definition of each field.
The returned value is a dictionary (indiced by field name) of
dictionaries. The _inherits'd fields are included. The string,
help, and selection (if present) attributes are translated.
"""
if context is None:
context = {}
res = {}
translation_obj = self.pool.get('ir.translation')
for parent in self._inherits:
res.update(self.pool.get(parent).fields_get(cr, user, allfields, context))
for f, field in self._columns.iteritems():
if allfields and f not in allfields:
continue
dict_field = fields.field_to_dict(self, cr, user, context, field)
res[f] = dict_field
if not write_access:
dict_field['readonly'] = True
dict_field['states'] = {}
if dict_field.has_key('string'):
res_trans = translation_obj._get_source(cr, user, self._name + ',' + f, 'field', context.get('lang', False) or 'en_US')
if res_trans:
dict_field['string'] = res_trans
if dict_field.has_key('help'):
help_trans = translation_obj._get_source(cr, user, self._name + ',' + f, 'help', context.get('lang', False) or 'en_US')
if help_trans:
dict_field['help'] = help_trans
if dict_field.has_key('selection'):
if isinstance(field.selection, (tuple, list)):
sel = field.selection
sel2 = []
for key, val in sel:
val2 = None
if val:
val2 = translation_obj._get_source(cr, user, self._name + ',' + f, 'selection', context.get('lang', False) or 'en_US', val)
sel2.append((key, val2 or val))
dict_field['selection'] = sel2
return res
** Affects: openobject-server
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/801897
Title:
Translations in Form and Tree View not work
Status in OpenERP Server:
New
Bug description:
Translation in Form and Tree View not work in latest Trunk, the
Problem is the fields_get Method on Line 1265 in orm.py
Here ist the Bugfix:
def fields_get(self, cr, user, allfields=None, context=None, write_access=True):
""" Returns the definition of each field.
The returned value is a dictionary (indiced by field name) of
dictionaries. The _inherits'd fields are included. The string,
help, and selection (if present) attributes are translated.
"""
if context is None:
context = {}
res = {}
translation_obj = self.pool.get('ir.translation')
for parent in self._inherits:
res.update(self.pool.get(parent).fields_get(cr, user, allfields, context))
for f, field in self._columns.iteritems():
if allfields and f not in allfields:
continue
dict_field = fields.field_to_dict(self, cr, user, context, field)
res[f] = dict_field
if not write_access:
dict_field['readonly'] = True
dict_field['states'] = {}
if dict_field.has_key('string'):
res_trans = translation_obj._get_source(cr, user, self._name + ',' + f, 'field', context.get('lang', False) or 'en_US')
if res_trans:
dict_field['string'] = res_trans
if dict_field.has_key('help'):
help_trans = translation_obj._get_source(cr, user, self._name + ',' + f, 'help', context.get('lang', False) or 'en_US')
if help_trans:
dict_field['help'] = help_trans
if dict_field.has_key('selection'):
if isinstance(field.selection, (tuple, list)):
sel = field.selection
sel2 = []
for key, val in sel:
val2 = None
if val:
val2 = translation_obj._get_source(cr, user, self._name + ',' + f, 'selection', context.get('lang', False) or 'en_US', val)
sel2.append((key, val2 or val))
dict_field['selection'] = sel2
return res
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/801897/+subscriptions
Follow ups
References