Make domain with None value for xxx2Many fields stringable

issue11810
review412101003
This commit is contained in:
Cédric Krier committed 2022-10-28 00:39:04 +02:00
1 parent d9daab7188
commit e71dffab5f
2 files changed
+2 -4

No files matched your search

+1 -4
View File
@@ -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:
@@ -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")]))