Adding a sidebar to a view

Initialization

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.

Programmatic folding and unfolding

The sidebar object starts folded. It provides three methods to handle its folding status:

do_toggle()

Toggles the status of the sidebar

do_fold()

Forces the sidebar closed if it’s currently open

do_unfold()

Forces the sidebar open if it’s currently closed