diff --git a/odoo/addons/test_convert/tests/test_convert.py b/odoo/addons/test_convert/tests/test_convert.py index 5a2a34af2a9..549b19acd69 100644 --- a/odoo/addons/test_convert/tests/test_convert.py +++ b/odoo/addons/test_convert/tests/test_convert.py @@ -265,6 +265,24 @@ class TestEvalXML(common.TransactionCase): def test_xml(self): pass - @unittest.skip("not tested") def test_html(self): - pass + self.assertEqual( + self.eval_xml(Field(ET.fromstring( + """ + + + + + + + """), type="html")), + """ + + + + + + + """, + "Evaluating an HTML field should give empty nodes instead of self-closing tags" + ) diff --git a/odoo/tools/convert.py b/odoo/tools/convert.py index 36b70b54b4a..0065cb3d612 100644 --- a/odoo/tools/convert.py +++ b/odoo/tools/convert.py @@ -142,7 +142,7 @@ def _eval_xml(self, node, env): return '\n'\ +_process("".join(etree.tostring(n, encoding='unicode') for n in node)) if t == 'html': - return _process("".join(etree.tostring(n, encoding='unicode') for n in node)) + return _process("".join(etree.tostring(n, method='html', encoding='unicode') for n in node)) data = node.text if node.get('file'):