summaryrefslogtreecommitdiff
path: root/addons/web
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2019-10-29 08:37:01 +0000
committerfw-bot <otis@odoo.com>2019-10-29 15:16:17 +0000
commit0562940f2c0cfb5483ba1043fffc86988d97445a (patch)
treec42160ae000457c51d3b6f168479bc7ea4c52ccf /addons/web
parent72fa7d7015dadb44e14c60f0ef08cf45654c1ddf (diff)
[FIX] mail: dicuss can save favorite filters
In discuss, make a search with some stuff, and try to save that filter as favorite Before this commit, there was a crash, because the Discuss action did not implement what the controllers do to save favorites. After this commit, it is possible to save a filter as favorite OPW 2087258 closes odoo/odoo#39519 X-original-commit: 5514a414324675bf5c2cc0360e429a7d2548b16f Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Diffstat (limited to 'addons/web')
-rw-r--r--addons/web/static/src/js/chrome/action_mixin.js24
-rw-r--r--addons/web/static/src/js/views/abstract_controller.js20
2 files changed, 26 insertions, 18 deletions
diff --git a/addons/web/static/src/js/chrome/action_mixin.js b/addons/web/static/src/js/chrome/action_mixin.js
index fa13e64e63e..b4a02879154 100644
--- a/addons/web/static/src/js/chrome/action_mixin.js
+++ b/addons/web/static/src/js/chrome/action_mixin.js
@@ -35,6 +35,15 @@ var ActionMixin = {
contentTemplate: null,
/**
+ * Events built by and managed by Odoo Framework
+ *
+ * It is expected that any Widget Class implementing this mixin
+ * will also implement the ParentedMixin which actually manages those
+ */
+ custom_events: {
+ get_controller_query_params: '_onGetControllerQueryParams',
+ },
+ /**
* If an action wants to use a control panel, it will be created and
* registered in this _controlPanel key (the widget). The way this control
* panel is created is up to the implementation (so, view controllers or
@@ -178,6 +187,21 @@ var ActionMixin = {
this._title = title;
this.updateControlPanel({title: this._title}, {clear: false});
},
+ /**
+ * FIXME: this logic should be rethought
+ *
+ * Handles a context request: provides to the caller the state of the
+ * current controller.
+ *
+ * @private
+ * @param {OdooEvent} ev
+ * @param {function} ev.data.callback used to send the requested state
+ */
+ _onGetControllerQueryParams: function (ev) {
+ ev.stopPropagation();
+ var state = this.getOwnedQueryParams();
+ ev.data.callback(state || {});
+ },
};
return ActionMixin;
diff --git a/addons/web/static/src/js/views/abstract_controller.js b/addons/web/static/src/js/views/abstract_controller.js
index 43a485fb009..780b0bcf1b6 100644
--- a/addons/web/static/src/js/views/abstract_controller.js
+++ b/addons/web/static/src/js/views/abstract_controller.js
@@ -24,14 +24,13 @@ var session = require('web.session');
var QWeb = core.qweb;
var AbstractController = mvc.Controller.extend(ActionMixin, {
- custom_events: {
- get_controller_query_params: '_onGetControllerQueryParams',
+ custom_events: _.extend({}, ActionMixin.custom_events, {
navigation_move: '_onNavigationMove',
open_record: '_onOpenRecord',
search: '_onSearch',
switch_view: '_onSwitchView',
search_panel_domain_updated: '_onSearchPanelDomainUpdated',
- },
+ }),
events: {
'click a[type="action"]': '_onActionClicked',
},
@@ -547,21 +546,6 @@ var AbstractController = mvc.Controller.extend(ActionMixin, {
}
},
/**
- * FIXME: this logic should be rethought
- *
- * Handles a context request: provides to the caller the state of the
- * current controller.
- *
- * @private
- * @param {OdooEvent} ev
- * @param {function} ev.data.callback used to send the requested state
- */
- _onGetControllerQueryParams: function (ev) {
- ev.stopPropagation();
- var state = this.getOwnedQueryParams();
- ev.data.callback(state || {});
- },
- /**
* Called either from the control panel to focus the controller
* or from the view to focus the search bar
*