diff options
| author | Aaron Bohy <aab@odoo.com> | 2018-03-19 08:03:31 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-03-19 08:12:09 +0100 |
| commit | e9db6b6d9de1e0589e8871ca2e5e8dde8ec8cab7 (patch) | |
| tree | 6e165242c0dc52b0b58b2d5d968c356431e8b889 /addons/web/static | |
| parent | 8bec4fa0157ad26ec786eee76651a28c8241828d (diff) | |
[FIX] web: search menus always available
Before this rev., the search menus (Filters, Group By, Favorites)
were lost when the user came back to an action with the
breadcrumbs (e.g. go to My pipeline, open a lead, click on the
Meetings stat button, go back to My pipeline).
This was because the two searchviews shared the same jQuery element
containing their dropdowns. This behavior is there for a long time,
but the bug has been revealed by 7b6056a0, which changes the way
the action manager and controllers interact with the control panel.
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Diffstat (limited to 'addons/web/static')
| -rw-r--r-- | addons/web/static/src/js/chrome/control_panel.js | 3 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/abstract_controller.js | 2 | ||||
| -rw-r--r-- | addons/web/static/tests/chrome/action_manager_tests.js | 27 |
3 files changed, 26 insertions, 6 deletions
diff --git a/addons/web/static/src/js/chrome/control_panel.js b/addons/web/static/src/js/chrome/control_panel.js index 03b9e756bb7..558dde933e9 100644 --- a/addons/web/static/src/js/chrome/control_panel.js +++ b/addons/web/static/src/js/chrome/control_panel.js @@ -252,9 +252,6 @@ var ControlPanel = Widget.extend({ */ _update_search_view: function (searchview, isHidden, groupable) { if (searchview) { - // Set the $buttons div (in the DOM) of the searchview as the $buttons - // have been appended to a jQuery node not in the DOM at SearchView initialization - searchview.$buttons = this.nodes.$searchview_buttons; searchview.toggle_visibility(!isHidden); if (groupable !== undefined){ searchview.groupby_menu.do_toggle(groupable); diff --git a/addons/web/static/src/js/views/abstract_controller.js b/addons/web/static/src/js/views/abstract_controller.js index f1356f72a81..1007aa6c720 100644 --- a/addons/web/static/src/js/views/abstract_controller.js +++ b/addons/web/static/src/js/views/abstract_controller.js @@ -320,7 +320,7 @@ var AbstractController = Widget.extend(ControlPanelMixin, { if (this.searchView) { _.extend(cpContent, { $searchview: this.searchView.$el, - $searchview_buttons: this.searchView.$buttons.contents(), + $searchview_buttons: this.searchView.$buttons, }); } this.update_control_panel({ diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js index 26c5f0af537..46b613a4cfe 100644 --- a/addons/web/static/tests/chrome/action_manager_tests.js +++ b/addons/web/static/tests/chrome/action_manager_tests.js @@ -2658,6 +2658,31 @@ QUnit.module('ActionManager', { actionManager.destroy(); }); + QUnit.test("search menus are still available when switching between actions", function (assert) { + assert.expect(3); + + var actionManager = createActionManager({ + actions: this.actions, + archs: this.archs, + data: this.data, + }); + + actionManager.doAction(1); + assert.strictEqual($('.o_search_options .o_dropdown:visible .o_filters_menu').length, 1, + "the search options should be available"); + + actionManager.doAction(3); + assert.strictEqual($('.o_search_options .o_dropdown:visible .o_filters_menu').length, 1, + "the search options should be available"); + + // go back using the breadcrumbs + $('.o_control_panel .breadcrumb a:first').click(); + assert.strictEqual($('.o_search_options .o_dropdown:visible .o_filters_menu').length, 1, + "the search options should be available"); + + actionManager.destroy(); + }); + QUnit.module('Actions in target="new"'); QUnit.test('can execute act_window actions in target="new"', function (assert) { @@ -2839,7 +2864,6 @@ QUnit.module('ActionManager', { QUnit.test('doAction resolved with an action', function (assert) { assert.expect(4); - var done = assert.async(); this.actions.push({ id: 21, @@ -2862,7 +2886,6 @@ QUnit.module('ActionManager', { assert.strictEqual(action.type, 'ir.actions.act_window_close', "should be resolved with correct action type"); actionManager.destroy(); - done(); }); }); }); |
