[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
This commit is contained in:
Rémy Voet (ryv)
2023-10-20 09:35:23 +00:00
parent 8cf98fbe67
commit c3bbba7cdd
@@ -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: '<tree><field name="m2o" widget="many2one"/></tree>',
});
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",