changeset e7959090939f in sao:default
details: https://hg.tryton.org/sao?cmd=changeset&node=e7959090939f
description:
Make domain with None value for xxx2Many fields stringable
issue11810
review412101003
diffstat:
src/common.js | 13 ++-----------
tests/sao.js | 1 +
2 files changed, 3 insertions(+), 11 deletions(-)
diffs (34 lines):
diff -r fed9fc5cfdfb -r e7959090939f src/common.js
--- a/src/common.js Wed Oct 26 23:30:54 2022 +0200
+++ b/src/common.js Fri Oct 28 00:39:04 2022 +0200
@@ -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 -r fed9fc5cfdfb -r e7959090939f tests/sao.js
--- a/tests/sao.js Wed Oct 26 23:30:54 2022 +0200
+++ b/tests/sao.js Fri Oct 28 00:39:04 2022 +0200
@@ -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"]]));