Each view has the responsibility to create its sidebar (or not) if and only if the sidebar flag is set in its options.
In that case, it should use the sidebar_id value (from its options) to initialize the sidebar at the right position in the DOM:
if (this.options.sidebar && this.options.sidebar_id) {
this.sidebar = new openerp.web.Sidebar(this, this.options.sidebar_id);
this.sidebar.start();
}
Because the sidebar is an old-style widget, it must be started after being initialized.
In order to behave correctly, a sidebar needs informations from its parent view.
This information is extracted via a very basic protocol consisting of a property and two methods:
the view’s dataset, used to fetch the currently active model and provide it to remote action handlers as part of the basic context
Used to query the parent view for the set of currently available record identifiers. Used to setup the basic context’s active_id and active_ids keys.
Warning
get_selected_ids() must return at least one id
Returns: | an array of at least one id |
---|---|
Return type: | Array<Number> |
Queries the view for additional context data to provide to the sidebar.
View() provides a default NOOP implementation, which simply resolves to an empty object.
Returns: | a promise yielding an object on success, this object is mergeed into the sidebar’s own context |
---|---|
Return type: | $.Deferred<Object> |