Skip to content
Snippets Groups Projects
Commit 89ad23bc authored by Nicolas Lempereur's avatar Nicolas Lempereur
Browse files

[FIX] web: auto_search false and search view

By default auto_search is set to `True` on window actions, this mean
that for example on a list or kanban view the records will be searched
on the view opening without any user action needed.

Setting it to `False` disable this.

Doing this had two drawbacks:

- depending on race condition, the view could be displayed before the
  search view was loaded,

- the code expected `active_search` to be present which was not the case
  in this instance.

Before 151c9074 the second issue would not happen (active_search was set
directly resolved if a search was not to be done) and this commit also
wait for the search view being ready before showing the view.

opw-741186
opw-741546
closes #16805
parent d7afa841
No related branches found
No related tags found
No related merge requests found
......@@ -149,16 +149,22 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
view.created = this.create_view.bind(this)(view, view_options);
}
this.active_search = $.Deferred();
// Call do_search on the searchview to compute domains, contexts and groupbys
if (this.search_view_loaded &&
this.flags.auto_search &&
view.controller.searchable !== false) {
this.active_search = $.Deferred();
$.when(this.search_view_loaded, view.created).done(function() {
self.searchview.do_search();
});
} else {
this.active_search.resolve();
}
var switched = $.when(view.created, this.active_search).then(function () {
var switched = $.when(
view.created,
this.search_view_loaded,
this.active_search
).then(function () {
return self._display_view(view_options, old_view).then(function () {
self.trigger('switch_mode', view_type, no_store, view_options);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment