def get_translation(self,value,lang):
result = value
- pool = pooler.get_pool(self.cr.dbname)
- translation_ids = pool.get('ir.translation').search(self.cr, self.uid, [('value','=',value),('lang','=',lang),('type','=','model')])
- if len(translation_ids):
- tran_id = translation_ids[0]
- translation = pool.get('ir.translation').read(self.cr, self.uid, tran_id, ['res_id','name'])
- res_model,field_name = tuple(translation['name'].split(','))
- res_id = translation['res_id']
- res = pool.get(res_model).read(self.cr, self.uid, res_id, [field_name])
- if res:
- result = res[field_name]
+ #TODO : to get translation term
return result
def directory_list_for_child(self,nodename,parent=False):
object: the object.directory or object.directory.content
object2: the other object linked (if object.directory.content)
"""
- def get_object(self, cr, uid, uri, context={}):
- lang = context.get('lang',False)
- if not lang:
- user = self.pool.get('res.users').browse(cr, uid, uid)
- lang = user.context_lang
- context['lang'] = lang
+ def get_object(self, cr, uid, uri, context={}):
+ #TODO : set user's context_lang in context
if not uri:
return node_class(cr, uid, '', False, context=context, type='database')
turi = tuple(uri)