diff --git a/odoo/addons/base/tests/test_qweb.py b/odoo/addons/base/tests/test_qweb.py index 28341bcda7a..d90d161a978 100644 --- a/odoo/addons/base/tests/test_qweb.py +++ b/odoo/addons/base/tests/test_qweb.py @@ -143,6 +143,24 @@ class TestQWebTField(TransactionCase): }) self.assertEqual(str(rendered.strip()), result.strip()) + def test_no_value_no_default_value(self): + # no value, no default value with attributes on t-field + t = self.env['ir.ui.view'].create({ + 'name': 'test', + 'type': 'qweb', + 'arch_db': ''' +
+ ''', + }) + result = """ +
+ """ + # inherit_branding puts attribute on the field tag as well as force the display in case the field is empty + rendered = self.env['ir.qweb'].with_context(inherit_branding=True)._render(t.id, { + 'record': self.env['res.partner'].new({}), + }) + self.assertEqual(str(rendered.strip()), result.strip()) + class TestQWebNS(TransactionCase): def test_render_static_xml_with_namespace(self):