[FIX] view requested by _view_ref with view_ref being undotted
Issue introduced in revid:chm@openerp.com-20130828161130-641xsmbr8xm53xjx: context of a fields_view_get can provide a *_view_ref name (e.g. tree_view_ref), whose value is an xid for the view to use (can be used to specify a view instead of providing a view_id, mostly for embedded views where there is no way to provide a view_id). The view_ref being an external id, it must be dotted. Historically, undotted xids were silently ignored and the system just skipped to getting the default view for the model (lowest priority view where inherit_id is null). In revid:odo@openerp.com-20130821122955-8c9z0mi8cu48rne3 this behavior was altered to emit a warning when ignoring a malformed view_ref. When this change was merged into trunk-website-al, the conditional (view_ref and '.' in view_ref) was split without consideration for the semantics change: a syntactically invalid view_ref would fall off the first branch (view_ref) instead of taking the second one (not view_ref), the code would not fetch the default view for the model and would instead generate one (through _get_default_%(viewtype)s_view). However, closer reading reveals the code was already broken in a specific case of a syntactically valid but unknown xid (view_id wouldn't get assigned in the first branch, but the code would not take the second one, resulting yet again in a view generation even if the database contains a valid view for the model and type). Fixed by reintroducing explicit second check on view_id, instead of merely conditional alternative. bzr revid: xmo@openerp.com-20140123075742-603n2zthqhxee07y
This commit is contained in:
parent
8d28d74dc9
commit
d50f785b4f
|
@ -1832,7 +1832,8 @@ class BaseModel(object):
|
|||
_logger.warning('%r requires a fully-qualified external id (got: %r for model %s). '
|
||||
'Please use the complete `module.view_id` form instead.', view_ref_key, view_ref,
|
||||
self._name)
|
||||
else:
|
||||
|
||||
if not view_id:
|
||||
# otherwise try to find the lowest priority matching ir.ui.view
|
||||
view_id = View.default_view(cr, uid, self._name, view_type, context=context)
|
||||
|
||||
|
|
Loading…
Reference in New Issue