From 2d13fa900bb82368a748bcd4618fda27d092a9b9 Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Tue, 19 Mar 2024 14:48:48 +0100 Subject: [PATCH] [FIX] tools: xpath tail for lxml 5.1.0 see https://github.com/lxml/lxml/commit/cc5ddbb1576d2844262a9d520867608aec956de9 Part-of: odoo/odoo#160842 Co-authored-by: Xavier Morel (xmo) --- odoo/tools/template_inheritance.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/odoo/tools/template_inheritance.py b/odoo/tools/template_inheritance.py index ac1aba0f2f8..ba7432eb9c3 100644 --- a/odoo/tools/template_inheritance.py +++ b/odoo/tools/template_inheritance.py @@ -238,6 +238,9 @@ def apply_inheritance_specs(source, specs_tree, inherit_branding=False, pre_loca # spec before the sentinel, then remove the sentinel element sentinel = E.sentinel() node.addnext(sentinel) + if node.tail is not None: # for lxml >= 5.1 + sentinel.tail = node.tail + node.tail = None add_stripped_items_before(sentinel, spec, extract) remove_element(sentinel) elif pos == 'before':