changeset c6c98fba1000 in sao:5.8 details: https://hg.tryton.org/sao?cmd=changeset&node=c6c98fba1000 description: Do not return None when evaluating domain with in operator
When the operator is 'in' and the value contains None, Field._domain_add_null adds an equal operator against NULL. So this must be managed like the '=' operator. issue9906 review332201005 (grafted from 03aa192c5c2bd4344f7165188ade3e4e0d8c99d4) diffstat: src/common.js | 6 +++++- tests/sao.js | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletions(-) diffs (37 lines): diff -r e8f4548f84cc -r c6c98fba1000 src/common.js --- a/src/common.js Tue Mar 16 22:07:08 2021 +0100 +++ b/src/common.js Sat Mar 20 12:33:09 2021 +0100 @@ -2232,7 +2232,11 @@ ((context_field === null) || (context_field === undefined) || (value === null) || - (value === undefined))) { + (value === undefined)) && + !(~['in', 'not in'].indexOf(operand) && + ((context_field === null) || + (context_field === undefined)) && + ((value instanceof Array) && ~value.indexOf(null)))) { return; } if ((context_field && context_field._isAMomentObject) && !value) { diff -r e8f4548f84cc -r c6c98fba1000 tests/sao.js --- a/tests/sao.js Tue Mar 16 22:07:08 2021 +0100 +++ b/tests/sao.js Sat Mar 20 12:33:09 2021 +0100 @@ -2675,6 +2675,17 @@ [[['x', 'in', [3, 5]]], {'x': [3]}, true], [[['x', 'in', [3, 5]]], {'x': [3, 4]}, true], [[['x', 'in', [3, 5]]], {'x': [1, 2]}, false], + [[['x', 'in', [3, 5]]], {'x': null}, false], + [[['x', 'in', [1, null]]], {'x': null}, true], + [[['x', 'in', [1, null]]], {'x': 2}, false], + [[['x', 'not in', [3, 5]]], {'x': 3}, false], + [[['x', 'not in', [3, 5]]], {'x': 4}, true], + [[['x', 'not in', [3, 5]]], {'x': [3]}, false], + [[['x', 'not in', [3, 5]]], {'x': [3, 4]}, false], + [[['x', 'not in', [3, 5]]], {'x': [1, 2]}, true], + [[['x', 'not in', [3, 5]]], {'x': null}, false], + [[['x', 'not in', [1, null]]], {'x': null}, false], + [[['x', 'not in', [1, null]]], {'x': 2}, true], [[['x', 'like', 'abc']], {'x': 'abc'}, true], [[['x', 'like', 'abc']], {'x': ''}, false], [[['x', 'like', 'abc']], {'x': 'xyz'}, false],