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
1=== modified file 'bin/osv/expression.py'
2--- bin/osv/expression.py 2011-01-17 08:41:08 +0000
3+++ bin/osv/expression.py 2012-05-02 04:58:25 +0000
4@@ -430,8 +430,11 @@
5 query = '(%s.%s IS NULL or %s.%s = false )' % (table._table, left,table._table, left)
6 elif (((right == False) and (type(right)==bool)) or (right is None)) and (operator == '='):
7 query = '%s.%s IS NULL ' % (table._table, left)
8- elif right == False and (leaf[0] in table._columns) and table._columns[leaf[0]]._type=="boolean" and (operator in ['<>', '!=']):
9- query = '(%s.%s IS NOT NULL and %s.%s != false)' % (table._table, left,table._table, left)
10+ elif right in (True, False) and (leaf[0] in table._columns) and table._columns[leaf[0]]._type=="boolean" and (operator in ['<>', '!=']):
11+ if right:
12+ query = '(%s.%s IS NULL or %s.%s = false)' % (table._table, left,table._table, left)
13+ else:
14+ query = '(%s.%s IS NOT NULL and %s.%s != false)' % (table._table, left,table._table, left)
15 elif (((right == False) and (type(right)==bool)) or right is None) and (operator in ['<>', '!=']):
16 query = '%s.%s IS NOT NULL' % (table._table, left)
17 elif (operator == '=?'):