Regression: many2one search operator 'in'

Bug #651999 reported by jftempo
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Status tracked in Trunk
5.0
Fix Released
High
Jay Vora (Serpent Consulting Services)
Trunk
Fix Released
High
Jay Vora (Serpent Consulting Services)

Bug Description

Performing a search an a many2one field with operator 'in' and an empty list returns all record.

Example:
self.pool.get('account.move.line').search(cr, uid, [('move_id','in',[])])
=> returns all account.move.line
=> it MUST return a empty list

Revision history for this message
jftempo (jfb-tempo-consulting) wrote :
Changed in openobject-server:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Jay (OpenERP) (jvo-openerp)
milestone: none → 5.0.15
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello JFB,

Thanks for reporting.

Would you please apply the patch and let us know the behavior?

Meanwhile,We are working on a better solution if feasible.

Revision history for this message
jftempo (jfb-tempo-consulting) wrote :

What kind of query do you try to match ?

IMHO for many2one we can have:
(field, 'in', [])
(field, 'not in', [])
(field, 'in', [int, int, ...])
(field, 'not in', [int, int, ...])
(field, 'in', ['char', 'char', ...])
(field, 'not in', ['char', 'char', ...])
    a tuple can replace a list

(field, '=', 'char')
(field, '!=', 'char')
(field, '=', int)
(field, '!=', int)
(field, '=', bool)
(field, '!=', bool)
(field, 'child_of', 'char')
(field, 'child_of', [int, int, int])
(field, like_op, 'char')
    with like_op: ('like', 'ilike', 'not like', '=like')

Any other kind of query is an alien and must produce an error:
(field, 'not in', 'char') is wrong
(field, '=', ['char', 'char']) is wrong

Are you agree with me ? If not please correct me.

Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello JFB,

      I agree with you that (field, '=', ['char', 'char']) is wrong but (field, 'not in', 'char']) is not wrong as the code is made like that to support it. 'not in' gets replaced by '!='. Still few changes were necessary that are made and I have attached a solution for that. Would you please check the attached patch and notify us?

Thanks

Revision history for this message
jftempo (jfb-tempo-consulting) wrote :

> (field, 'not in', 'char') is not wrong as the code is made like that

Is it really necessary to complexify the code for unused and unlogical cases ?

Please keep it simple and bug free: remove thoses many2one queries in your code:
  [(field, '>=', ...)], [(field, 'not in', 'char')].

Changed in openobject-server:
status: Confirmed → In Progress
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello JFB,

We cover as many conditions and not letting any error occur.

Can you please check with the latest patch?

Thanks.

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

Fixed in : by

Stable : 2138 <email address hidden>
Trunk : 2831 <email address hidden>

Thanks.

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

Hello senthilnathang,

It would sound better if you specify reason why you performed change in 'state' of this thread?

I hope you are aware about the meaning of each state.

Thanks.

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.