From 22da602fbaa0e8d7d68d5c4cd90c37930cd956f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 28 Oct 2022 00:39:04 +0200 Subject: [PATCH] Make domain with None value for xxx2Many fields stringable issue11810 review412101003 --- src/common.js | 13 ++----------- tests/sao.js | 1 + 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/common.js b/src/common.js index b16f923579..9aa0ede752 100644 --- a/src/common.js +++ b/src/common.js @@ -1183,17 +1183,8 @@ if (~['many2one', 'one2one', 'one2many', 'many2many'] .indexOf(field.type)) { var test = function(value) { - if (field.type == 'many2one') { - if ((typeof value != 'string') && - (value !== null)) { - return false; - } - } else { - if (typeof value != 'string') { - return false; - } - } - return true; + return ((typeof value == 'string') || + (value === null)); }; if (value instanceof Array) { return value.every(test); diff --git a/tests/sao.js b/tests/sao.js index 5c4e8049ad..f4b982671f 100644 --- a/tests/sao.js +++ b/tests/sao.js @@ -2109,6 +2109,7 @@ QUnit.ok(parser.stringable([['relation.rec_name', '=', 'Foo']])); QUnit.ok(!parser.stringable([['relation', '=', 1]])); QUnit.ok(parser.stringable([['relations', '=', 'Foo']])); + QUnit.ok(parser.stringable([['relations', '=', null]])); QUnit.ok(parser.stringable([['relations', 'in', ['Foo']]])); QUnit.ok(!parser.stringable([['relations', 'in', [42]]])); QUnit.ok(parser.stringable([['relation.name', '=', "Foo"]]));