From 6f29cbe3ace5302781aa51d727b4358903efb373 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 23 Nov 2015 16:52:57 +0100 Subject: [PATCH] [FIX] website,ir_qweb: prevent inherit_branding for assets The attribute `data-oe-*` (`data-oe-id`, `data-oe-model`, ...) must not be added when rendering the assets, to avoid having different assets content, e.g. a different content for the assets_common, according if the user is signed in or not, if the user can edit the website or not. A different content for an assets according to the users rights or the user being signed in or not means that the assets are permanently re-written in the filestore, which is against the point of the assets. The content of the assets (assets_common) must not be different from time to time, it must always be the same (except when installing a new module, obviously). Adding the `data-oe` attributes was pointless for the assets anyway, and prevented having an identical content all the time, therefore rewritting the assets all the time in the filestore. opw-657046 --- addons/website/models/ir_ui_view.py | 9 +++++---- openerp/addons/base/ir/ir_qweb.py | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/website/models/ir_ui_view.py b/addons/website/models/ir_ui_view.py index 9a3a84a9adb..35ce4cdd6a9 100644 --- a/addons/website/models/ir_ui_view.py +++ b/addons/website/models/ir_ui_view.py @@ -158,10 +158,11 @@ class view(osv.osv): qcontext.update(values) # in edit mode ir.ui.view will tag nodes - if qcontext.get('editable'): - context = dict(context, inherit_branding=True) - elif request.registry['res.users'].has_group(cr, uid, 'base.group_website_publisher'): - context = dict(context, inherit_branding_auto=True) + if not qcontext.get('rendering_bundle'): + if qcontext.get('editable'): + context = dict(context, inherit_branding=True) + elif request.registry['res.users'].has_group(cr, uid, 'base.group_website_publisher'): + context = dict(context, inherit_branding_auto=True) view_obj = request.website.get_template(id_or_xml_id) if 'main_object' not in qcontext: diff --git a/openerp/addons/base/ir/ir_qweb.py b/openerp/addons/base/ir/ir_qweb.py index c183a013430..dd043a32a0c 100644 --- a/openerp/addons/base/ir/ir_qweb.py +++ b/openerp/addons/base/ir/ir_qweb.py @@ -1091,6 +1091,7 @@ class AssetsBundle(object): context = self.context.copy() context['inherit_branding'] = False + context['inherit_branding_auto'] = False context['rendering_bundle'] = True self.html = self.registry['ir.ui.view'].render(self.cr, self.uid, xmlid, context=context) self.parse()