From bbac9f0f231a8cffe7c2e2420ff133af66ab088f Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 12 Nov 2013 15:08:22 +0100 Subject: [PATCH] [ADD] Add hook for qweb preprocessing bzr revid: fme@openerp.com-20131112140822-7p37hu8gd82ta5aj --- openerp/addons/base/ir/ir_qweb.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/openerp/addons/base/ir/ir_qweb.py b/openerp/addons/base/ir/ir_qweb.py index 7021b90edcd..ef5c49d571f 100644 --- a/openerp/addons/base/ir/ir_qweb.py +++ b/openerp/addons/base/ir/ir_qweb.py @@ -177,7 +177,7 @@ class QWeb(orm.AbstractModel): def register_tag(self, tag, func): self._render_tag[tag] = func - def load_document(self, x, into): + def load_document(self, x, into, context): """ Loads an XML document and installs any contained template in the engine """ @@ -190,12 +190,15 @@ class QWeb(orm.AbstractModel): for n in dom.documentElement.childNodes: if n.nodeType == self.node.ELEMENT_NODE and n.getAttribute('t-name'): - into[str(n.getAttribute("t-name"))] = n + self.add_template(into, str(n.getAttribute("t-name")), n, context) + + def add_template(self, into, name, node, context): + into[name] = node def get_template(self, name, context): if context.loader and name not in context.templates: xml_doc = context.loader(name) - self.load_document(xml_doc, into=context.templates) + self.load_document(xml_doc, into=context.templates, context=context) if name in context.templates: return context.templates[name]