[IMP] Raise console.error when no action.type defined
authorFabien Meghazi <fme@openerp.com>
Wed, 7 Dec 2011 16:13:53 +0000 (17:13 +0100)
committerFabien Meghazi <fme@openerp.com>
Wed, 7 Dec 2011 16:13:53 +0000 (17:13 +0100)
I see this error from times to times but never had a chance to reproduce it.
console.error will give a traceback + action object in order to fix the issue

bzr revid: fme@openerp.com-20111207161353-vnp6dm21xyedxgeg

addons/web/static/src/js/views.js

index 403aa7c..cae83d4 100644 (file)
@@ -75,6 +75,10 @@ session.web.ActionManager = session.web.Widget.extend({
         }
     },
     do_action: function(action, on_close) {
+        if (!action.type) {
+            console.error("No type for action", action);
+            return;
+        }
         var type = action.type.replace(/\./g,'_');
         var popup = action.target === 'new';
         action.flags = _.extend({
@@ -85,7 +89,7 @@ session.web.ActionManager = session.web.Widget.extend({
             pager : !popup
         }, action.flags || {});
         if (!(type in this)) {
-            console.log("Action manager can't handle action of type " + action.type, action);
+            console.error("Action manager can't handle action of type " + action.type, action);
             return;
         }
         return this[type](action, on_close);