changeset 03aa192c5c2b in sao:default
details: https://hg.tryton.org/sao?cmd=changeset&node=03aa192c5c2b
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
diffstat:
src/common.js | 6 +++++-
tests/sao.js | 11 +++++++++++
2 files changed, 16 insertions(+), 1 deletions(-)
diffs (37 lines):
diff -r 539991bd08f8 -r 03aa192c5c2b src/common.js
--- a/src/common.js Thu Mar 18 22:32:34 2021 +0100
+++ b/src/common.js Sat Mar 20 12:33:09 2021 +0100
@@ -2245,7 +2245,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 539991bd08f8 -r 03aa192c5c2b tests/sao.js
--- a/tests/sao.js Thu Mar 18 22:32:34 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],