Display asserted inherit expression when nothing found

issue11560
review419311003
This commit is contained in:
Adrià Tarroja Caubet
2022-06-15 18:59:58 +02:00
parent 638f5505fa
commit 16275e0259
+3 -2
View File
@@ -265,8 +265,9 @@ class View(ModelSQL, ModelView):
def inherit_apply(cls, tree, inherit):
root_inherit = inherit.getroottree().getroot()
for element in root_inherit:
targets = tree.xpath(element.get('expr'))
assert targets
expr = element.get('expr')
targets = tree.xpath(expr)
assert targets, "No elements found for expression %r" % expr
for target in targets:
position = element.get('position', 'inside')
new_tree = getattr(cls, '_inherit_apply_%s' % position)(