From beb6a719bca17edff161d1a6510e374556e2dbe6 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 7 Feb 2022 15:35:17 +0000 Subject: [PATCH] [FIX] core: do not translate html attributes without actual content The issue has been introduced by 1fe4b0cc1981382cc3d944ec44276f0aee90945d. A simple example is an element with attribute "string" like When the translation process is parsing the value of the attribute as some HTML fragment html.from_string(" "), it raises an exception. This was not a problem before the commit above, but it now is. For instance, updating the view "event.view_event_form" triggers the error. closes odoo/odoo#84144 X-original-commit: 5ffc1704162d8918985964b08f4b2b49e6054958 Signed-off-by: Raphael Collet Signed-off-by: Christophe Simonis --- odoo/tools/translate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/tools/translate.py b/odoo/tools/translate.py index 1822140482c..c2718de1c3e 100644 --- a/odoo/tools/translate.py +++ b/odoo/tools/translate.py @@ -260,7 +260,7 @@ def translate_xml_node(node, callback, parse, serialize): # translate the attributes of the node for key, val in node.attrib.items(): - if val and key in TRANSLATED_ATTRS and TRANSLATED_ATTRS[key](node): + if nonspace(val) and key in TRANSLATED_ATTRS and TRANSLATED_ATTRS[key](node): node.set(key, callback(val.strip()) or val) process(node)