From 646ccfc5304af697b27f4fc308fbd12ee81a4947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Mon, 8 Jul 2019 12:16:58 +0000 Subject: [PATCH] [FIX] web: Display boolean title in list views Since commit 9fbb4fb, the `title` attribute is added to list views ``. The title value is given by field utils formatting methods, according to the field type. However, for boolean fields, the formatting method does not return a string but a jquery element (unless `forceString: true` is given as an option). Hence, the displayed title is `[Object object]`. After this commit, boolean fields do not have any title. closes odoo/odoo#34657 Signed-off-by: Aaron Bohy (aab) --- .../web/static/src/js/views/list/list_renderer.js | 3 ++- addons/web/static/tests/views/list_tests.js | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/js/views/list/list_renderer.js index 76db6727285..2cbaf3a6374 100644 --- a/addons/web/static/src/js/views/list/list_renderer.js +++ b/addons/web/static/src/js/views/list/list_renderer.js @@ -364,7 +364,8 @@ var ListRenderer = BasicRenderer.extend({ isPassword: 'password' in node.attrs, }); this._handleAttributes($td, node); - return $td.html(formattedValue).attr('title', formattedValue); + var title = field.type !== 'boolean' ? formattedValue : ''; + return $td.html(formattedValue).attr('title', title); }, /** * Renders the button element associated to the given node and record. diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index be34bd19999..2336e9a4543 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -249,6 +249,19 @@ QUnit.module('Views', { list.destroy(); }); + QUnit.test('boolean field has no title', async function (assert) { + assert.expect(1); + + var list = await createView({ + View: ListView, + model: 'foo', + data: this.data, + arch: '', + }); + assert.equal(list.$('tbody tr:first td:eq(1)').attr('title'), ""); + list.destroy(); + }); + QUnit.test('record-depending invisible lines are correctly aligned', async function (assert) { assert.expect(4);