[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.
This commit is contained in:
Christophe Matthieu
2018-08-13 17:09:28 +02:00
parent 9a98a4d60e
commit 19106533d3
+4
View File
@@ -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):