[MERGE] orm: fixed translations for inherited views when the parent view uses a diffe...
authorVo Minh Thu (OpenERP) <>
Wed, 15 Dec 2010 18:24:16 +0000 (19:24 +0100)
committerOlivier Dony <odo@openerp.com>
Wed, 15 Dec 2010 18:24:16 +0000 (19:24 +0100)
bzr revid: odo@openerp.com-20101215182416-yk4n4krmw2anuyt3

1  2 
bin/osv/orm.py

diff --cc bin/osv/orm.py
@@@ -1392,7 -1392,7 +1392,9 @@@ class orm_template(object)
          if ('lang' in context) and not result:
              if node.get('string'):
                  trans = self.pool.get('ir.translation')._get_source(cr, user, self._name, 'view', context['lang'], node.get('string'))
-                 if not trans and ('base_model_name' in context):
+                 if trans == node.get('string') and ('base_model_name' in context):
++                    # If translation is same as source, perhaps we'd have more luck with the alternative model name
++                    # (in case we are in a mixed situation, such as an inherited view where parent_view.model != model
                      trans = self.pool.get('ir.translation')._get_source(cr, user, context['base_model_name'], 'view', context['lang'], node.get('string'))
                  if trans:
                      node.set('string', trans)
              result['field_parent'] = False
              result['view_id'] = 0
  
-         xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=context)
+         if parent_view_model != self._name:
 -          ctx = context.copy()
 -          ctx['base_model_name'] = parent_view_model
++            ctx = context.copy()
++            ctx['base_model_name'] = parent_view_model
+         else:
 -          ctx = context
++            ctx = context
+         xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=ctx)
          result['arch'] = xarch
          result['fields'] = xfields