Bugfix: Search inactive (active = False) elements will always fail

Even if args contain ['active','=',0], _where_calc function add an active
   test, leading to 'where active = True and active = False' SQL queries.

bzr revid: x.alt@ajm.lu-20081030154226-7yd1xvqleisqksld
This commit is contained in:
Xavier ALT
2008-10-30 16:42:26 +01:00
parent a84df166ee
commit 8a657d79cb
+6 -1
View File
@@ -2354,7 +2354,12 @@ class orm(orm_template):
# records unless they were explicitely asked for
if 'active' in self._columns and (active_test and context.get('active_test', True)):
if args:
args.insert(0, ('active', '=', 1))
active_in_args = False
for a in args:
if a[0] == 'active':
active_in_args = True
if not active_in_args:
args.insert(0, ('active', '=', 1))
else:
args = [('active', '=', 1)]