From 19106533d3f2518e764fcb05a26ca562f58219e6 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 30 Jul 2018 10:27:08 +0200 Subject: [PATCH] [FIX] qweb: t-call can be called with an id Following the new studio features, the use of t-call in templates with the id occurs. Doing the verification of the integer type of the template in addition to checking whether the value of type string is a number or not should be done at different levels. It is therefore simpler to ensure that the value is a number or an xml_id in compile which is the entry point of the render and t-call. The cache made on compile does not change because we have no case where a template is called with a number of type string in addition to being called with an integer. --- odoo/addons/base/models/ir_qweb.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/odoo/addons/base/models/ir_qweb.py b/odoo/addons/base/models/ir_qweb.py index 2b8b896fd29..e933ce787b6 100644 --- a/odoo/addons/base/models/ir_qweb.py +++ b/odoo/addons/base/models/ir_qweb.py @@ -106,6 +106,10 @@ class IrQWeb(models.AbstractModel, QWeb): tools.ormcache('id_or_xml_id', 'tuple(options.get(k) for k in self._get_template_cache_keys())'), ) def compile(self, id_or_xml_id, options): + try: + id_or_xml_id = int(id_or_xml_id) + except: + pass return super(IrQWeb, self).compile(id_or_xml_id, options=options) def load(self, name, options):