summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorPriyanka Kakadiya <pka@odoo.com>2018-01-23 16:58:50 +0530
committerAaron Bohy <aab@odoo.com>2018-02-05 14:55:30 +0100
commitf787ac9edb5fe291f0088c11fbcaa9ebf268f3f5 (patch)
tree30042d10d23190c0f28f85126902b5c8e4e269ce /addons/web/static/src
parenta76f8715fb6e1642c169c92452180486634e3a9d (diff)
[FIX] web: ActionManager: switch to unknown view
A traceback occurred on the Intrastat list view (Accounting > Reporting > Management > Intrastat), when the user clicked on a row of the list. This action only specifies 2 view modes: list and kanban. When a record is clicked, the ActionManager tries to open that record in a form view. As the view isn't in the action, this request should be ignored. Before this rev., this case wasn't correctly supported.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/chrome/action_manager_act_window.js9
1 files changed, 8 insertions, 1 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 56c6e45a08d..7963af8ec32 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
@@ -159,6 +159,14 @@ ActionManager.include({
*/
_createViewController: function (action, viewType, viewOptions, options) {
var self = this;
+ var viewDescr = _.findWhere(action.views, {type: viewType});
+ if (!viewDescr) {
+ // the requested view type isn't specified in the action (e.g.
+ // action with list view only, user clicks on a row in the list, it
+ // tries to switch to form view)
+ return $.Deferred().reject();
+ }
+
var controllerID = _.uniqueId('controller_');
var controller = {
actionID: action.jsID,
@@ -184,7 +192,6 @@ ActionManager.include({
// communication with trigger_up (e.g. for 'env_updated' event)
viewOptions = _.extend(viewOptions, { controllerID: controllerID });
- var viewDescr = _.findWhere(action.views, {type: viewType});
var view = new viewDescr.Widget(viewDescr.fieldsView, viewOptions);
var def = $.Deferred();
action.controllers[viewType] = def;