diff options
| author | Aaron Bohy <aab@odoo.com> | 2015-06-16 14:04:16 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2015-06-16 14:14:07 +0200 |
| commit | c31ef083ff9a5a907b99d2a2476ac996d67c7038 (patch) | |
| tree | 371c89b2276a3ed6f33705bc972682772846448d /addons/web/static/src/js/view_manager.js | |
| parent | 8406eeb4408d7c7c5cf0e7e943b5fc4d7164debf (diff) | |
[FIX] web: view_manager: instantiate sidebar before calling do_show
In google_drive, the sidebar is extended and listens to the event
load_record triggered when do_show of form_view is performed. The
sidebar should thus be instantiated before calling do_show, otherwise
the gdrive button is not available for the first record displayed in
a form_view.
Diffstat (limited to 'addons/web/static/src/js/view_manager.js')
| -rw-r--r-- | addons/web/static/src/js/view_manager.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/web/static/src/js/view_manager.js b/addons/web/static/src/js/view_manager.js index 5fbfd40f3da..d5ca65b5d61 100644 --- a/addons/web/static/src/js/view_manager.js +++ b/addons/web/static/src/js/view_manager.js @@ -155,6 +155,7 @@ var ViewManager = Widget.extend(ControlPanelMixin, { _display_view: function (view_options) { var self = this; var view_controller = this.active_view.controller; + var view_control_elements = this.render_view_control_elements(); // Show the view this.active_view.$container.show(); @@ -163,7 +164,7 @@ var ViewManager = Widget.extend(ControlPanelMixin, { var cp_status = { active_view_selector: '.oe-cp-switch-' + self.active_view.type, breadcrumbs: self.action_manager && self.action_manager.get_breadcrumbs(), - cp_content: _.extend({}, self.control_elements, self.render_view_control_elements()), + cp_content: _.extend({}, self.control_elements, view_control_elements), hidden: self.flags.headless, searchview: self.searchview, search_view_hidden: view_controller.searchable === false, @@ -243,7 +244,11 @@ var ViewManager = Widget.extend(ControlPanelMixin, { /** * Renders the control elements (buttons, sidebar, pager) of the current view * This must be done when active_search is resolved (for KanbanViews) - * Fills this.active_view.control_elements dictionnary with the rendered elements + * Fills this.active_view.control_elements dictionnary with the rendered + * elements and the adequate view switcher, to send to the ControlPanel + * Warning: it should be called before calling do_show on the view as the + * sidebar is extended to listen on the load_record event triggered as soon + * as do_show is done (the sidebar should thus be instantiated before) */ render_view_control_elements: function() { if (!this.active_view.control_elements) { |
