From 1fdbbdda6955ac2c5f84630a6cf1184deac8dffc Mon Sep 17 00:00:00 2001 From: "alexandre.fayolle@camptocamp.com" <> Date: Wed, 21 Aug 2013 11:49:13 +0200 Subject: [PATCH 1/2] [FIX] [DOC] make it explicit that the module name is mandatory when specifying a sub view via the context lp bug: https://launchpad.net/bugs/1214799 fixed bzr revid: alexandre.fayolle@camptocamp.com-20130821094913-2frk2550b4szka5s --- doc/03_module_dev_03.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/03_module_dev_03.rst b/doc/03_module_dev_03.rst index 40921eebcb5..b7a23b81385 100644 --- a/doc/03_module_dev_03.rst +++ b/doc/03_module_dev_03.rst @@ -1356,7 +1356,16 @@ specify a view id for each type of view supported, exactly like the action's .. code-block:: xml + context="{'form_view_ref' : 'module.view_id', + 'tree_view_ref' : 'module.view_id'}"/> + +.. note:: + + You have to put the module name in xml id of the view, because this + is evaluated when the view is displayed, and not when the XML file + is parsed, so the module name information is not available. Failing + to do so will result in the default view being selected (see + below). If you don't specify the views, OpenERP will choose one in this order : From c57b85ed535a33e4d3bb03c981ac9463d50714bc Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 21 Aug 2013 13:58:22 +0200 Subject: [PATCH 2/2] [DOC] minor wording/formatting/nitpicking on top of previous patch bzr revid: odo@openerp.com-20130821115822-kd9d8m1upvo5wiux --- doc/03_module_dev_03.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/03_module_dev_03.rst b/doc/03_module_dev_03.rst index b7a23b81385..fd82f36bff1 100644 --- a/doc/03_module_dev_03.rst +++ b/doc/03_module_dev_03.rst @@ -1351,21 +1351,22 @@ When you add a one2many field in a form view, you do something like this : If you want to specify the views to use, you can add a *context* attribute, and specify a view id for each type of view supported, exactly like the action's -*view_id* attribute: +*view_id* attribute, except that the provided view id must always be +fully-qualified with the module name, even if it belongs to the same module: .. code-block:: xml + context="{'form_view_ref': 'module.view_id', + 'tree_view_ref': 'module.view_id'}"/> .. note:: - You have to put the module name in xml id of the view, because this + You *have to* put the module name in the view_id, because this is evaluated when the view is displayed, and not when the XML file is parsed, so the module name information is not available. Failing to do so will result in the default view being selected (see - below). + below). If you don't specify the views, OpenERP will choose one in this order :