[FIX] #menu_id loading, move client_actions registry
authorAntony Lesuisse <al@openerp.com>
Tue, 15 May 2012 15:34:23 +0000 (17:34 +0200)
committerAntony Lesuisse <al@openerp.com>
Tue, 15 May 2012 15:34:23 +0000 (17:34 +0200)
bzr revid: al@openerp.com-20120515153423-bj6vgiuwq26cyq5o

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

index ef75bbf..b71a504 100644 (file)
@@ -966,7 +966,9 @@ instance.web.WebClient = instance.web.Widget.extend({
         if (!_.isEqual(this._current_state, state)) {
             if(state.action_id === undefined && state.menu_id) {
                 self.menu.has_been_loaded.then(function() {
-                    self.menu.menu_click(state.menu_id);
+                    self.menu.do_reload().then(function() {
+                        self.menu.menu_click(state.menu_id)
+                    });
                 });
             } else {
                 this.action_manager.do_load_state(state, !!this._current_state);
index 8e7b5d4..5a8a2b5 100644 (file)
@@ -579,6 +579,33 @@ $.async_when = function() {
                return old_async_when.apply(this, arguments);
 };
 
+/**
+ * Registry for all the client actions key: tag value: widget
+ */
+instance.web.client_actions = new instance.web.Registry();
+
+/**
+ * Client action to reload the whole interface.
+ * If params has an entry 'menu_id', it opens the given menu entry.
+ */
+instance.web.client_actions.add("reload", "instance.web.Reload");
+
+instance.web.Reload = instance.web.Widget.extend({
+    init: function(parent, params) {
+        this._super(parent);
+        this.menu_id = (params && params.menu_id) || false;
+    },
+    start: function() {
+        if (this.menu_id) {
+            // open the given menu id
+            var url_without_fragment = window.location.toString().split("#", 1)[0];
+            window.location = url_without_fragment + "#menu_id=" + this.menu_id;
+        } else {
+            window.location.reload();
+        }
+    }
+});
+
 };
 
 // vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
index 941c1f8..de2ff53 100644 (file)
@@ -1262,33 +1262,6 @@ instance.web.str_to_xml = function(s) {
 }
 
 /**
- * Registry for all the client actions key: tag value: widget
- */
-instance.web.client_actions = new instance.web.Registry();
-
-/**
- * Client action to reload the whole interface.
- * If params has an entry 'menu_id', it opens the given menu entry.
- */
-instance.web.client_actions.add("reload", "instance.web.Reload");
-
-instance.web.Reload = instance.web.Widget.extend({
-    init: function(parent, params) {
-        this._super(parent);
-        this.menu_id = (params && params.menu_id) || false;
-    },
-    start: function() {
-        if (this.menu_id) {
-            // open the given menu id
-            var url_without_fragment = window.location.toString().split("#", 1)[0];
-            window.location = url_without_fragment + "#menu_id=" + this.menu_id;
-        } else {
-            window.location.reload();
-        }
-    }
-});
-
-/**
  * Registry for all the main views
  */
 instance.web.views = new instance.web.Registry();