[IMP] Lazy module_boot() loading

Removed 'modules' item in ir.ui.view rendering context.
Replaced by lazy helper get_modules_order
This commit is contained in:
Fabien Meghazi 2014-07-01 12:14:55 +02:00 committed by Antony Lesuisse
parent 7785a3bc83
commit a49ebae676
2 changed files with 12 additions and 7 deletions

View File

@ -23,9 +23,6 @@
<script type="text/javascript" src="/web/static/lib/qweb/qweb2.js"></script>
<script type="text/javascript" src="/web/static/src/js/openerpframework.js"></script>
<script type="text/javascript" src="/web/static/src/js/tour.js"></script>
<script type="text/javascript" charset="utf-8">
openerp._modules = <t t-raw="modules"/>;
</script>
<link rel="stylesheet" href="/web/static/lib/fontawesome/css/font-awesome.css"/>
</template>
@ -85,6 +82,9 @@
<script type="text/javascript" src="/web/static/lib/backbone/backbone.js"></script>
<!-- Internals -->
<script type="text/javascript" charset="utf-8">
openerp._modules = <t t-raw="get_modules_order()"/>;
</script>
<link rel="stylesheet" href="/web/static/src/css/base.css"/>
<link rel="stylesheet" href="/web/static/src/css/data_export.css"/>
<link rel="stylesheet" href="/base/static/src/css/modules.css"/>

View File

@ -986,10 +986,15 @@ class view(osv.osv):
)
qcontext.update(values)
# TODO: remove this as soon as the following branch is merged
# lp:~openerp-dev/openerp-web/trunk-module-closure-style-msh
from openerp.addons.web.controllers.main import module_boot
qcontext['modules'] = simplejson.dumps(module_boot()) if request else None
# TODO: This helper can be used by any template that wants to embedd the backend.
# It is currently necessary because the ir.ui.view bundle inheritance does not
# match the module dependency graph.
def get_modules_order():
if request:
from openerp.addons.web.controllers.main import module_boot
return simplejson.dumps(module_boot())
return '[]'
qcontext['get_modules_order'] = get_modules_order
def loader(name):
return self.read_template(cr, uid, name, context=context)