Rifakat (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-server/6.0-opw-574105-rha into 
lp:openobject-server/6.0.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-574105-rha/+merge/104323

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

-- 
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-574105-rha/+merge/104323
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/6.0-opw-574105-rha.
=== 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 @@
                 query = '(%s.%s IS NULL or %s.%s = false )' % (table._table, left,table._table, left)
             elif (((right == False) and (type(right)==bool)) or (right is None)) and (operator == '='):
                 query = '%s.%s IS NULL ' % (table._table, left)
-            elif right == False and (leaf[0] in table._columns)  and table._columns[leaf[0]]._type=="boolean"  and (operator in ['<>', '!=']):
-                query = '(%s.%s IS NOT NULL and %s.%s != false)' % (table._table, left,table._table, left)
+            elif right in (True, False) and (leaf[0] in table._columns)  and table._columns[leaf[0]]._type=="boolean"  and (operator in ['<>', '!=']):
+                if right:
+                    query = '(%s.%s IS NULL or %s.%s = false)' % (table._table, left,table._table, left)
+                else:
+                    query = '(%s.%s IS NOT NULL and %s.%s != false)' % (table._table, left,table._table, left)
             elif (((right == False) and (type(right)==bool)) or right is None) and (operator in ['<>', '!=']):
                 query = '%s.%s IS NOT NULL' % (table._table, left)
             elif (operator == '=?'):

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to