Unquoted 0 in domain is converted to None when generating SQL

Bug #677509 reported by Daniel Watkins (credativ)
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Incomplete
Low
OpenERP's Framework R&D

Bug Description

For an act_window definition, we have the following domain set:
  domain=[('unallocated_products', '!=', '0')]

This works fine. However, if we have:
  domain=[('unallocated_products', '!=', 0)]
(i.e. without the quotes around 0) then we end up with qu1 and qu2 in the search() method on osv.orm containining
  ((1=1) AND (made_batches_batch.stock_move_id in (%s,%s,%s,%s,%s,%s,%s,%s))) AND (made_batches_batch.unallocated_products != %s)
and
  [43, 46, 49, 50, 51, 52, 53, 101, None]

This will produce a WHERE clause including "(made_batches_batch.unallocated_products != None". Needless to say, this meant that nothing was working as expected, and should be fixed.

Amit Parik (amit-parik)
Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Low
status: New → Confirmed
Changed in openobject-server:
status: Confirmed → Invalid
status: Invalid → Confirmed
Revision history for this message
Yogesh (SerpentCS) (yogesh-serpentcs) wrote :

Hello Daniel,

I would like to know that what is type of the field unallocated_products?

I am testing few scenarios, but it fails only with Boolean fields.

Thanks for reporting.

Revision history for this message
gpa(OpenERP) (gpa-openerp) wrote :

Hello,

Still we don't reproduce this error.

Would you please provide more information?

Thanks.

Changed in openobject-server:
status: Confirmed → Incomplete
Revision history for this message
Daniel Watkins (credativ) (daniel-watkins-credativ) wrote :

It's a function field with store={...} set.

Changed in openobject-server:
status: Incomplete → New
Changed in openobject-server:
status: New → In Progress
Revision history for this message
gpa(OpenERP) (gpa-openerp) wrote :

Hello Daniel,

I tried with the function field store ={}, but not able to produce the error.

It give the same result in both the case, when I give domain=[('unallocated_products', '!=', '0')] or domain=[('unallocated_products', '!=', 0)].

I would like to request you to please elaborate this with the suitable steps.

Thanks

Changed in openobject-server:
status: In Progress → Incomplete
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.