[PATCH] Fix AssertionError with empty WHERE clause
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned |
Bug Description
OpenERP from current 7.0 branch and all earlier 7.0 versions may crash with the following traceback when using some specific search expressions:
2014-04-15 07:57:09,032 4668 ERROR cmlid-test openerp.netsvc:
Traceback (most recent call last):
File "/usr/lib/
result = ExportService.
File "/usr/lib/
res = fn(db, uid, *params)
File "/usr/lib/
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/usr/lib/
return f(self, dbname, *args, **kwargs)
File "/usr/lib/
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/lib/
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/lib/
return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
File "/usr/lib/
query = self._where_
File "/usr/lib/
e = expression.
File "/usr/lib/
self.parse(cr, uid, context=context)
File "/usr/lib/
right_ids = relational_
File "/usr/lib/
return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
File "/usr/lib/
query = self._where_
File "/usr/lib/
where_clause, where_params = e.to_sql()
File "/usr/lib/
assert len(stack) == 1
AssertionError
The attached patch fixes this issue in expression.py by checking for empty list of leaves beforehand and returns an empty WHERE clause in this case. It works because orm.py already checks for empty values.
Hi Jean-Baptiste, it would be interesting to see a sample query (e.g. a domain expression triggering the bug).