diff --git a/sao/src/common.js b/sao/src/common.js index c5f175c178..1d2c37dce6 100644 --- a/sao/src/common.js +++ b/sao/src/common.js @@ -1197,7 +1197,7 @@ }, stringable: function(domain) { const stringable_ = clause => { - if (!clause) { + if (!clause || jQuery.isEmptyObject(clause)) { return true; } var is_array = function(e) { diff --git a/sao/tests/sao.js b/sao/tests/sao.js index 023a3a6ad9..24d75e156d 100644 --- a/sao/tests/sao.js +++ b/sao/tests/sao.js @@ -2179,6 +2179,8 @@ }); var valid = ['name', '=', 'Doe']; var invalid = ['surname', '=', 'John']; + QUnit.ok(parser.stringable([])); + QUnit.ok(parser.stringable([[]])); QUnit.ok(parser.stringable([valid])); QUnit.ok(!parser.stringable([invalid])); QUnit.ok(parser.stringable(['AND', valid])); diff --git a/tryton/tryton/tests/test_common_domain_parser.py b/tryton/tryton/tests/test_common_domain_parser.py index 6d469adade..c5144de52f 100644 --- a/tryton/tryton/tests/test_common_domain_parser.py +++ b/tryton/tryton/tests/test_common_domain_parser.py @@ -592,6 +592,8 @@ class DomainParserTestCase(TestCase): }) valid = ('name', '=', 'Doe') invalid = ('surname', '=', 'John') + self.assertTrue(dom.stringable([])) + self.assertTrue(dom.stringable([[]])) self.assertTrue(dom.stringable([valid])) self.assertFalse(dom.stringable([invalid])) self.assertTrue(dom.stringable(['AND', valid]))