[FIX] read_combined and get_inheriting_views_arch when no model provided

* view['model'] required for base_model_name handling, force its read
  as with arch (nb: arch could actually be made optional, if it's not
  being read can skip most of the inheritance complexity no?)

* if model=None in get_inheriting_views_arch, it generates domain to
  SQL `model is NULL`, except model required on ir.ui.view so unspec'd
  models are `''` (the empty string) not NULL => inherited views never
  found.

  Righter move might be to formally make model non-required on view.

bzr revid: xmo@openerp.com-20130426090237-u3rojvx4gow6uue1
This commit is contained in:
Xavier Morel 2013-04-26 11:02:37 +02:00
parent 7883944c19
commit 9d06d98735
1 changed files with 6 additions and 3 deletions

View File

@ -200,8 +200,11 @@ class view(osv.osv):
view_id = self.default_view(cr, uid, model, view_type, context=context)
root_id = self.root_ancestor(cr, uid, view_id, context=context)
if fields and 'arch' not in fields:
fields = list(itertools.chain(['arch'], fields))
if fields:
needed_fields = ['arch', 'model']
fields = list(itertools.chain(
[field for field in needed_fields if field not in fields],
fields))
[view] = self.read(cr, uid, [root_id], fields=fields, context=context)
@ -281,7 +284,7 @@ class view(osv.osv):
"""
user_groups = frozenset(self.pool.get('res.users').browse(cr, 1, uid, context).groups_id)
conditions = [['inherit_id', '=', view_id], ['model', '=', model]]
conditions = [['inherit_id', '=', view_id], ['model', '=', model or '']]
if self.pool._init:
# Module init currently in progress, only consider views from
# modules whose code is already loaded