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"]]));