summaryrefslogtreecommitdiff
path: root/addons/web
diff options
context:
space:
mode:
authorAntony Lesuisse <al@openerp.com>2011-12-27 20:44:05 +0100
committerAntony Lesuisse <al@openerp.com>2011-12-27 20:44:05 +0100
commitdd79eb534b9a58e2fc54435c9ebe43f30ba00baa (patch)
treec7dbdbc614ceb7e6899f0fff045a9c545650a210 /addons/web
parentcfc87346a489badd9b26c34f14f5be4a86f11da0 (diff)
[IMP] initial module loading improvements
bzr revid: al@openerp.com-20111227194405-rz3kxbib03orbpr8
Diffstat (limited to 'addons/web')
-rw-r--r--addons/web/static/src/js/boot.js8
-rw-r--r--addons/web/static/src/js/core.js8
2 files changed, 7 insertions, 9 deletions
diff --git a/addons/web/static/src/js/boot.js b/addons/web/static/src/js/boot.js
index c2aea24276b..282435f2a71 100644
--- a/addons/web/static/src/js/boot.js
+++ b/addons/web/static/src/js/boot.js
@@ -22,20 +22,20 @@
* @param {Array} modules list of modules to initialize
*/
init: function(modules) {
+ // By default only web will be loaded, the rest will be by loaded
+ // by openerp.web.Connection on the first session_authenticate
+ modules = modules || ["web"];
var new_instance = {
// links to the global openerp
_openerp: openerp,
- // Only web will be loaded, the rest will be by loaded by
- // openerp.web.Connection on the first connection
- _modules_loaded: false,
// this unique id will be replaced by hostname_databasename by
// openerp.web.Connection on the first connection
_session_id: "session" + session_counter++,
+ _modules: modules,
web: {},
web_mobile: {}
};
openerp.sessions[new_instance._session_id] = new_instance;
- modules = modules || ["web"];
for(var i=0; i < modules.length; i++) {
openerp[modules[i]](new_instance);
}
diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js
index 646b71834c9..1554127e2e6 100644
--- a/addons/web/static/src/js/core.js
+++ b/addons/web/static/src/js/core.js
@@ -553,9 +553,10 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp.
user_context: result.context,
openerp_entreprise: result.openerp_entreprise
});
- var deferred = self.do_load_qweb(['/web/webclient/qweb']);
+ var modules = openerp._modules.join(',');
+ var deferred = self.rpc('/web/webclient/qweblist', {mods: modules}).pipe(self.do_load_qweb);
if(self.session_is_valid()) {
- return deferred.pipe(_.bind(function() { this.load_modules(); }, self));
+ return deferred.pipe(function() { self.load_modules(); });
}
return deferred;
});
@@ -636,9 +637,6 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp.
*/
load_modules: function() {
var self = this;
- if(openerp._modules_loaded) {
- return $.when();
- }
return this.rpc('/web/session/modules', {}).pipe(function(result) {
self.module_list = result;
var lang = self.user_context.lang;