[FIX] translation of some labels in one2many fields. Thanks to Dainius Malachovskis...
authorChristophe Simonis <christophe@tinyerp.com>
Fri, 28 Nov 2008 09:09:34 +0000 (10:09 +0100)
committerChristophe Simonis <christophe@tinyerp.com>
Fri, 28 Nov 2008 09:09:34 +0000 (10:09 +0100)
lp bug: https://launchpad.net/bugs/279613 fixed

bzr revid: christophe@tinyerp.com-20081128090934-lffnwuf8q4zqvs6j

bin/osv/orm.py

index e933464..78671ab 100644 (file)
@@ -784,7 +784,9 @@ class orm_template(object):
                     for f in node.childNodes:
                         if f.nodeType == f.ELEMENT_NODE and f.localName in ('form', 'tree', 'graph'):
                             node.removeChild(f)
-                            xarch, xfields = self.pool.get(relation).__view_look_dom_arch(cr, user, f, context)
+                            ctx = context.copy()
+                            ctx['base_model_name'] = self._name
+                            xarch, xfields = self.pool.get(relation).__view_look_dom_arch(cr, user, f, ctx)
                             views[str(f.localName)] = {
                                 'arch': xarch,
                                 'fields': xfields
@@ -823,6 +825,8 @@ class orm_template(object):
             if ('lang' in context) and not result:
                 if node.hasAttribute('string') and node.getAttribute('string'):
                     trans = tools.translate(cr, self._name, 'view', context['lang'], node.getAttribute('string').encode('utf8'))
+                    if not trans and ('base_model_name' in context):
+                        trans = tools.translate(cr, context['base_model_name'], 'view', context['lang'], node.getAttribute('string').encode('utf8'))
                     if trans:
                         node.setAttribute('string', trans.decode('utf8'))
                 if node.hasAttribute('sum') and node.getAttribute('sum'):
@@ -836,8 +840,6 @@ class orm_template(object):
         return fields
 
     def __view_look_dom_arch(self, cr, user, node, context=None):
-        if not context:
-            context = {}
         fields_def = self.__view_look_dom(cr, user, node, context=context)
 
         buttons = xpath.Evaluate('//button', node)