[5.0] one2many field domain 'in' empty list incorrectly returns records

Bug #655889 reported by Russell Briggs
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

There is a bug in expression.py when evaluating 'in' conditions for empty lists [] on one2many fields. It returns a list of non-matching ids instead of the expected empty list.

This is similar to bug #651999: Regression: many2one search operator 'in'

It is possible to see this bug using standard modules and the openobject object model:

1. install base_contact module
2. Add some contacts that are not attached to a company
3. Create a company that doesn't have any contacts
4. Now run a search for contacts in the company you created that does not have any. e.g. by running the following API call:

self.pool.get('res.partner.contact').search(cr, uid, [('partner_id','=', <id_of_company_with_no_contacts> )])

Instead of an empty list, you will actually get the IDs of all contacts that are NOT a member of a company!

Its a simple code fix. In the latest expression.py (rev 2138) on line 188:

Replace:

    if right:

with:

    if right or (right==[]):

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Duplicate of https://bugs.launchpad.net/openobject-server/+bug/626806.
Please see details on it.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.