From: Fabien Meghazi Date: Tue, 16 Sep 2014 14:27:27 +0000 (+0200) Subject: [IMP] add `url_for` hook to bundle urls X-Git-Tag: 8.0.0~38^2~2 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=7bc7757ec3afd89785c5970efca94071761d7747;p=odoo%2Fodoo.git [IMP] add `url_for` hook to bundle urls --- diff --git a/openerp/addons/base/ir/ir_qweb.py b/openerp/addons/base/ir/ir_qweb.py index 82aefb3..2e8adaa 100644 --- a/openerp/addons/base/ir/ir_qweb.py +++ b/openerp/addons/base/ir/ir_qweb.py @@ -1034,6 +1034,7 @@ class AssetsBundle(object): context = self.context.copy() context['inherit_branding'] = False + context['rendering_bundle'] = True self.html = self.registry['ir.ui.view'].render(self.cr, self.uid, xmlid, context=context) self.parse() @@ -1086,10 +1087,13 @@ class AssetsBundle(object): for jscript in self.javascripts: response.append(jscript.to_html()) else: + url_for = self.context.get('url_for', lambda url: url) if css and self.stylesheets: - response.append('' % (self.xmlid, self.version)) + href = '/web/css/%s/%s' % (self.xmlid, self.version) + response.append('' % url_for(href)) if js: - response.append('' % (self.xmlid, self.version)) + src = '/web/js/%s/%s' % (self.xmlid, self.version) + response.append('' % url_for(src)) response.extend(self.remains) return sep + sep.join(response)