示例#1
0
    def test_issearchdomain(self):
        self.assertFalse(issearchdomain(None))
        self.assertFalse(issearchdomain(42))
        self.assertFalse(issearchdomain('42'))
        self.assertFalse(issearchdomain([1, 42]))
        self.assertFalse(issearchdomain(['1', '42']))

        self.assertTrue(issearchdomain([('name', '=', 'mushroom'),
                                        ('state', '!=', 'draft')]))
        self.assertTrue(issearchdomain(['name = mushroom', 'state != draft']))
        self.assertTrue(issearchdomain([]))
        self.assertTrue(issearchdomain('state != draft'))
        self.assertTrue(issearchdomain(('state', '!=', 'draft')))
示例#2
0
    def test_issearchdomain(self):
        self.assertFalse(issearchdomain(None))
        self.assertFalse(issearchdomain(42))
        self.assertFalse(issearchdomain('42'))
        self.assertFalse(issearchdomain([1, 42]))
        self.assertFalse(issearchdomain(['1', '42']))

        self.assertTrue(issearchdomain([('name', '=', 'mushroom'),
                                        ('state', '!=', 'draft')]))
        self.assertTrue(issearchdomain(['name = mushroom', 'state != draft']))
        self.assertTrue(issearchdomain([]))

        # Removed with 1.6
        self.assertFalse(issearchdomain('state != draft'))
        self.assertFalse(issearchdomain(('state', '!=', 'draft')))
    def count_records(self, model, domain):
        """Filter all records for model according to domain and
        return the number of matching records."""

        assert erppeek.issearchdomain(domain), "Invalid domain argument!"
        res = self.client.count(model, domain)
        return res
    def search_records(self, model, domain, offset=0, limit=None, order=None,
                       context=None):
        """Filter all the records for model according to domain and
           return the ids of matching records."""

        assert erppeek.issearchdomain(domain), "Invalid domain argument!"
        res_ids = self.client.search(
            model, domain, offset=offset, limit=limit, order=order,
            context=context
        )
        return res_ids