diff --git a/addons/web/__openerp__.py b/addons/web/__openerp__.py index 74633fa4969..e4a6f235836 100644 --- a/addons/web/__openerp__.py +++ b/addons/web/__openerp__.py @@ -2,6 +2,7 @@ "name" : "web", "depends" : [], 'active': True, + 'web_auto_load': True, 'js' : [ "static/lib/datejs/globalization/en-US.js", "static/lib/datejs/core.js", diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index d0c8950f9e1..729829b592c 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -104,7 +104,7 @@ home_template = textwrap.dedent(""" %(javascript)s '%i for i in jslist]) # css tags - csslist = ['/web/webclient/css'] + csslist = ['/web/webclient/css?mods='+cs_mods] if req.debug: - csslist = [i + '?debug=' + str(time.time()) for i in manifest_glob(req.config.addons_path, ['web'], 'css')] + csslist = [i + '?debug=' + str(time.time()) for i in manifest_glob(req.config.addons_path, modules, 'css')] css = "\n ".join([''%i for i in csslist]) + r = home_template % { 'javascript': js, - 'css': css + 'css': css, + 'modules': repr(modules), # XXX good js-ification ? } return r @@ -342,7 +348,7 @@ class Session(openerpweb.Controller): # TODO query server for installed web modules mods = [] for name, manifest in openerpweb.addons_manifest.items(): - if name != 'web' and manifest.get('active', True): + if not manifest.get('web_auto_load') and manifest.get('active', True): mods.append(name) return mods diff --git a/addons/web/static/src/js/boot.js b/addons/web/static/src/js/boot.js index b9d5180b5c4..27dc4dcda5e 100644 --- a/addons/web/static/src/js/boot.js +++ b/addons/web/static/src/js/boot.js @@ -19,9 +19,9 @@ /** * OpenERP instance constructor * - * @param {Boolean} skip_init if true, skips the built-in initialization + * @param {Array} modules list of modules to initialize */ - init: function(skip_init) { + init: function(modules) { var new_instance = { // links to the global openerp _openerp: openerp, @@ -35,9 +35,9 @@ web_mobile: {} }; openerp.sessions[new_instance._session_id] = new_instance; - if (!skip_init){ - openerp.web(new_instance); - } + _.each(modules, function (element, index, list) { + openerp[element](new_instance); + }); return new_instance; } }; diff --git a/addons/web_hello/__openerp__.py b/addons/web_hello/__openerp__.py index 7a80645f3b8..f67ff4b23d5 100644 --- a/addons/web_hello/__openerp__.py +++ b/addons/web_hello/__openerp__.py @@ -5,4 +5,5 @@ "js": ["static/*/*.js", "static/*/js/*.js"], "css": [], 'active': False, + 'web_auto_load': True, } diff --git a/addons/web_hello/static/openerp/base_hello.js b/addons/web_hello/static/openerp/base_hello.js index 99c97006eac..91caf263196 100644 --- a/addons/web_hello/static/openerp/base_hello.js +++ b/addons/web_hello/static/openerp/base_hello.js @@ -13,6 +13,13 @@ openerp.web.SearchView = openerp.web.SearchView.extend({ // here you may tweak globals object, if any, and play with on_* or do_* callbacks on them +openerp.web.Login = openerp.web.Login.extend({ + start: function() { + console.log('Hello there'); + this._super.apply(this,arguments); + } +}); + }; // vim:et fdc=0 fdl=0: