diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 7b670b0be22..cd5dc9949d8 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -3823,7 +3823,10 @@ class orm(orm_template): offset_str = offset and ' offset %d' % offset or '' where.extend(qu1_join) - where_str = " WHERE %s" % " AND ".join(where) + if where: + where_str = " WHERE %s" % " AND ".join(where) + else: + where_str = "" if count: cr.execute('select count(%s.id) from ' % self._table +