summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/chrome/action_manager_act_window.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2018-03-21 12:43:17 +0100
committerGéry Debongnie <ged@odoo.com>2018-04-03 15:19:42 +0200
commit5b3cb812be853c5b116a7bbf945f1c878e6b6fe0 (patch)
treed8993f21349db71feef12594f43ab04b09132d0e /addons/web/static/src/js/chrome/action_manager_act_window.js
parent3dc48c79c9570b8f6cb608f1fca3e641e321ca44 (diff)
[IMP] web: SearchView: add/remove filter from outside
This rev. allows to add or remove filters to the SearchView from the outside, and to make it display this new domain. This can be used by views that trigger domain changes (e.g. this is the case of the new DashboardView).
Diffstat (limited to 'addons/web/static/src/js/chrome/action_manager_act_window.js')
-rw-r--r--addons/web/static/src/js/chrome/action_manager_act_window.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/addons/web/static/src/js/chrome/action_manager_act_window.js b/addons/web/static/src/js/chrome/action_manager_act_window.js
index be6ac5e2230..f505cccadfe 100644
--- a/addons/web/static/src/js/chrome/action_manager_act_window.js
+++ b/addons/web/static/src/js/chrome/action_manager_act_window.js
@@ -22,6 +22,7 @@ ActionManager.include({
env_updated: '_onEnvUpdated',
execute_action: '_onExecuteAction',
get_controller_context: '_onGetControllerContext',
+ update_filters: '_onUpdateFilters',
search: '_onSearch',
switch_view: '_onSwitchView',
}),
@@ -774,6 +775,22 @@ ActionManager.include({
ev.data.callback(context || {});
},
/**
+ * Handles a request to add/remove search view filters.
+ *
+ * @param {OdooEvent} ev
+ * @param {string} ev.data.controllerID
+ * @param {Array[Object]} [ev.data.newFilters]
+ * @param {Array[Object]} [ev.data.filtersToRemove]
+ * @param {function} ev.data.callback called with the added filters as arg
+ */
+ _onUpdateFilters: function (ev) {
+ var controller = this.controllers[ev.data.controllerID];
+ var action = this.actions[controller.actionID];
+ var data = ev.data;
+ var addedFilters = action.searchView.updateFilters(data.newFilters, data.filtersToRemove);
+ data.callback(addedFilters);
+ },
+ /**
* Called when there is a change in the search view, so the current action's
* environment needs to be updated with the new domain, context and groupby.
*