diff options
| author | Aaron Bohy <aab@odoo.com> | 2018-03-01 11:19:23 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-03-06 09:12:21 +0100 |
| commit | cdb01d52ea0a7b3b02594f2bd98d1a7bdf2fa2a3 (patch) | |
| tree | d2969057a9670a18b5c0f1ca5e9de5a1e4b91c15 /addons/web/static/src/js/chrome/abstract_web_client.js | |
| parent | bc66da2dfaf399f642836256c67a65a5468cd47a (diff) | |
[FIX] web: create favorite filters in dialogs
This is a manual forwardport of rev. b466b3bc608.
Consider the following scenario: open in edit mode a form view
containing a many2many field displayed with widget many2many_tags,
on the many2many field dropdown, click on 'Search More' (it opens
a dialog), and in the dialog, try to save the current search in
the searchview's favorite menu.
Before this rev., it crashed because it tried to retrieve the
action's context (to add to the saved filter), whereas there is no
action in this case.
Actually, the action's context should never been used in this case.
What must be used is the controller's context (this mainly makes
sense for Pivot and Graph views).
Fixes #23293
Diffstat (limited to 'addons/web/static/src/js/chrome/abstract_web_client.js')
| -rw-r--r-- | addons/web/static/src/js/chrome/abstract_web_client.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/addons/web/static/src/js/chrome/abstract_web_client.js b/addons/web/static/src/js/chrome/abstract_web_client.js index b4b192c1ea9..9fe38adbde6 100644 --- a/addons/web/static/src/js/chrome/abstract_web_client.js +++ b/addons/web/static/src/js/chrome/abstract_web_client.js @@ -68,6 +68,7 @@ var AbstractWebClient = Widget.extend(ServiceProviderMixin, { .load_filters(event.data.dataset, event.data.action_id) .then(event.data.on_success); }, + create_filter: '_onCreateFilter', push_state: '_onPushState', show_effect: '_onShowEffect', // session @@ -338,6 +339,18 @@ var AbstractWebClient = Widget.extend(ServiceProviderMixin, { //-------------------------------------------------------------------------- /** + * @private + * @param {OdooEvent} e + * @param {Object} e.data.filter the filter description + * @param {function} e.data.on_success called when the RPC succeeds with its + * returned value as argument + */ + _onCreateFilter: function (e) { + data_manager + .create_filter(e.data.filter) + .then(e.data.on_success); + }, + /** * Displays a warning in a dialog of with the NotificationManager * * @private |
