From c3bbba7cdd4c29a6cf45f7e37bbfc1bad7c1f037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Voet=20=28ryv=29?= Date: Tue, 17 Oct 2023 16:03:05 +0200 Subject: [PATCH] [FIX] web: fix `extraLines` for false display_name Since https://github.com/odoo/odoo/pull/137098, in `Accounting > Bank > Tree View`, you get a traceback if one of the bank statements in the view has a false as `display_name` (name is only required in the view not in the model). The traceback comes from the `extraLines` accessor in the Many2one component. The fix is the same as in https://github.com/odoo/odoo/pull/138061 (FW of the first PR). Part-of: odoo/odoo#139215 --- addons/web/static/tests/views/list_view_tests.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/addons/web/static/tests/views/list_view_tests.js b/addons/web/static/tests/views/list_view_tests.js index b7efa7b57e8..8cbd793b090 100644 --- a/addons/web/static/tests/views/list_view_tests.js +++ b/addons/web/static/tests/views/list_view_tests.js @@ -2545,6 +2545,21 @@ QUnit.module("Views", (hooks) => { ); }); + QUnit.test("many2one field rendering with many2one widget", async function (assert) { + serverData.models.bar.records[0].display_name = false + await makeView({ + type: "list", + resModel: "foo", + serverData, + arch: '', + }); + + assert.ok( + $(target).find("td:contains(Unnamed)").length, + "should have a Unnamed as fallback of many2one display_name" + ); + }); + QUnit.test("grouped list view, with 1 open group", async function (assert) { await makeView({ type: "list",