From e71dffab5f81016608f027c54a854c83defae532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 28 Oct 2022 00:39:04 +0200 Subject: [PATCH] Make domain with None value for xxx2Many fields stringable issue11810 review412101003 --- tryton/common/domain_parser.py | 5 +---- tryton/tests/test_common_domain_parser.py | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tryton/common/domain_parser.py b/tryton/common/domain_parser.py index 78935ca47e..24fc800b20 100644 --- a/tryton/common/domain_parser.py +++ b/tryton/common/domain_parser.py @@ -578,10 +578,7 @@ class DomainParser(object): 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 --git a/tryton/tests/test_common_domain_parser.py b/tryton/tests/test_common_domain_parser.py index 4c847b3a94..b9c91e72ff 100644 --- a/tryton/tests/test_common_domain_parser.py +++ b/tryton/tests/test_common_domain_parser.py @@ -607,6 +607,7 @@ class DomainParserTestCase(TestCase): 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")]))