summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/view_dialogs.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2018-03-01 11:19:23 +0100
committerAaron Bohy <aab@odoo.com>2018-03-06 09:12:21 +0100
commitcdb01d52ea0a7b3b02594f2bd98d1a7bdf2fa2a3 (patch)
treed2969057a9670a18b5c0f1ca5e9de5a1e4b91c15 /addons/web/static/src/js/views/view_dialogs.js
parentbc66da2dfaf399f642836256c67a65a5468cd47a (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/views/view_dialogs.js')
-rw-r--r--addons/web/static/src/js/views/view_dialogs.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/view_dialogs.js b/addons/web/static/src/js/views/view_dialogs.js
index 4be84c23b71..1b74068d44d 100644
--- a/addons/web/static/src/js/views/view_dialogs.js
+++ b/addons/web/static/src/js/views/view_dialogs.js
@@ -260,6 +260,7 @@ var SelectCreateDialog = ViewDialog.extend({
var searchData = this._process_search_data(d.domains, d.contexts, d.groupbys);
this.list_controller.reload(searchData);
},
+ get_controller_context: '_onGetControllerContext',
}),
/**
@@ -416,6 +417,24 @@ var SelectCreateDialog = ViewDialog.extend({
dialog.on('closed', this, this.close);
return dialog;
},
+
+ //--------------------------------------------------------------------------
+ // Handlers
+ //--------------------------------------------------------------------------
+
+ /**
+ * Handles a context request: provides to the caller the context of the
+ * list controller.
+ *
+ * @private
+ * @param {OdooEvent} ev
+ * @param {function} ev.data.callback used to send the requested context
+ */
+ _onGetControllerContext: function (ev) {
+ ev.stopPropagation();
+ var context = this.list_controller && this.list_controller.getContext();
+ ev.data.callback(context || {});
+ }
});
return {