[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>
This commit is contained in:
co-authored by
Mathieu Duckerts-Antoine
parent
8bec4fa015
commit
e9db6b6d9d
@@ -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);
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user