Merge lp:~openerp-dev/openobject-server/6.0-opw-574105-rha into lp:openobject-server/6.0

Proposed by Rifakat Husen (OpenERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 3615
Proposed branch: lp:~openerp-dev/openobject-server/6.0-opw-574105-rha
Merge into: lp:openobject-server/6.0
Diff against target: 17 lines (+5/-2)
1 file modified
bin/osv/expression.py (+5/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.0-opw-574105-rha
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Review via email: mp+104323@code.launchpad.net

Description of the change

Hello,

Boolean!=True domain is not properly evaluated in customer filter and gives wrong result.

To reproduce this problem,
-> Open list view of products
-> product has active field. Make some product inactive(active=False) and update value for
   active as NULL in database for some of the fields.
-> Create custom filter for Boolean=False, Boolean!=True. Both should give same result but
   Boolean!=True gives products with value False, and does not consider NULL value.

This fix solves this problem.
Thanks for your review.

Regards,
Rifakat Haradwala

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve

Unmerged revisions

3615. By Rifakat Husen (OpenERP)

[FIX]: boolean!=True is not evaluated properly

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/osv/expression.py'
--- bin/osv/expression.py 2011-01-17 08:41:08 +0000
+++ bin/osv/expression.py 2012-05-02 04:58:25 +0000
@@ -430,8 +430,11 @@
430 query = '(%s.%s IS NULL or %s.%s = false )' % (table._table, left,table._table, left)430 query = '(%s.%s IS NULL or %s.%s = false )' % (table._table, left,table._table, left)
431 elif (((right == False) and (type(right)==bool)) or (right is None)) and (operator == '='):431 elif (((right == False) and (type(right)==bool)) or (right is None)) and (operator == '='):
432 query = '%s.%s IS NULL ' % (table._table, left)432 query = '%s.%s IS NULL ' % (table._table, left)
433 elif right == False and (leaf[0] in table._columns) and table._columns[leaf[0]]._type=="boolean" and (operator in ['<>', '!=']):433 elif right in (True, False) and (leaf[0] in table._columns) and table._columns[leaf[0]]._type=="boolean" and (operator in ['<>', '!=']):
434 query = '(%s.%s IS NOT NULL and %s.%s != false)' % (table._table, left,table._table, left)434 if right:
435 query = '(%s.%s IS NULL or %s.%s = false)' % (table._table, left,table._table, left)
436 else:
437 query = '(%s.%s IS NOT NULL and %s.%s != false)' % (table._table, left,table._table, left)
435 elif (((right == False) and (type(right)==bool)) or right is None) and (operator in ['<>', '!=']):438 elif (((right == False) and (type(right)==bool)) or right is None) and (operator in ['<>', '!=']):
436 query = '%s.%s IS NOT NULL' % (table._table, left)439 query = '%s.%s IS NOT NULL' % (table._table, left)
437 elif (operator == '=?'):440 elif (operator == '=?'):