changeset 4fdb04e8c89e in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset&node=4fdb04e8c89e
description:
Make domain with None value for xxx2Many fields stringable
issue11810
review412101003
diffstat:
tryton/common/domain_parser.py | 5 +----
tryton/tests/test_common_domain_parser.py | 1 +
2 files changed, 2 insertions(+), 4 deletions(-)
diffs (26 lines):
diff -r e68329ceaeb2 -r 4fdb04e8c89e tryton/common/domain_parser.py
--- a/tryton/common/domain_parser.py Thu Oct 27 13:24:22 2022 +0200
+++ b/tryton/common/domain_parser.py Fri Oct 28 00:39:04 2022 +0200
@@ -578,10 +578,7 @@
field = self.fields[name]
if field['type'] in {
'many2one', 'one2one', 'one2many', 'many2many'}:
- if field['type'] == 'many2one':
- types = (str, type(None))
- else:
- types = str
+ types = (str, type(None))
if isinstance(value, (list, tuple)):
return all(isinstance(v, types) for v in value)
else:
diff -r e68329ceaeb2 -r 4fdb04e8c89e tryton/tests/test_common_domain_parser.py
--- a/tryton/tests/test_common_domain_parser.py Thu Oct 27 13:24:22 2022 +0200
+++ b/tryton/tests/test_common_domain_parser.py Fri Oct 28 00:39:04 2022 +0200
@@ -607,6 +607,7 @@
self.assertTrue(dom.stringable([('relation.rec_name', '=', "Foo")]))
self.assertFalse(dom.stringable([('relation', '=', 1)]))
self.assertTrue(dom.stringable([('relations', '=', "Foo")]))
+ self.assertTrue(dom.stringable([('relations', '=', None)]))
self.assertTrue(dom.stringable([('relations', 'in', ["Foo"])]))
self.assertFalse(dom.stringable([('relations', 'in', [42])]))
self.assertTrue(dom.stringable([('relation.name', '=', "Foo")]))