From 8a657d79cb168c272354a67b100ca154c1b5b8e4 Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Thu, 30 Oct 2008 16:42:26 +0100 Subject: [PATCH] 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 --- bin/osv/orm.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index fed44126277..9572053b844 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -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)]