bugfix for active=false search

bzr revid: hda@tinyerp.com-20081110110721-t55bijn008yq4z7b
This commit is contained in:
hda@tinyerp.com 2008-11-10 16:37:21 +05:30
commit 74af540f43
1 changed files with 5 additions and 6 deletions

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$ # $Id$
# #
@ -359,7 +359,7 @@ class orm_template(object):
view_load=%s, select_level=%s, readonly=%s ,required=%s view_load=%s, select_level=%s, readonly=%s ,required=%s
WHERE WHERE
model=%s AND name=%s""", ( model=%s AND name=%s""", (
vals['model_id'], vals['field_description'], vals['ttype'], vals['model_id'], vals['field_description'], vals['ttype'],
vals['relation'], bool(vals['view_load']), vals['relation'], bool(vals['view_load']),
vals['select_level'], bool(vals['readonly']),bool(vals['required']), vals['model'], vals['name'] vals['select_level'], bool(vals['readonly']),bool(vals['required']), vals['model'], vals['name']
)) ))
@ -724,7 +724,7 @@ class orm_template(object):
if val: if val:
val2 = translation_obj._get_source(cr, user, val2 = translation_obj._get_source(cr, user,
self._name + ',' + f, 'selection', self._name + ',' + f, 'selection',
context.get('lang', False) or 'en_US', val) context.get('lang', False) or 'en_US', val)
sel2.append((key, val2 or val)) sel2.append((key, val2 or val))
sel = sel2 sel = sel2
res[f]['selection'] = sel res[f]['selection'] = sel
@ -838,7 +838,7 @@ class orm_template(object):
continue continue
ok = True ok = True
if user != 1: # admin user has all roles if user != 1: # admin user has all roles
serv = netsvc.LocalService('object_proxy') serv = netsvc.LocalService('object_proxy')
user_roles = serv.execute_cr(cr, user, 'res.users', 'read', [user], ['roles_id'])[0]['roles_id'] user_roles = serv.execute_cr(cr, user, 'res.users', 'read', [user], ['roles_id'])[0]['roles_id']
@ -2365,13 +2365,12 @@ class orm(orm_template):
# records unless they were explicitely asked for # records unless they were explicitely asked for
if 'active' in self._columns and (active_test and context.get('active_test', True)): if 'active' in self._columns and (active_test and context.get('active_test', True)):
if args: if args:
args.insert(0, ('active', '=', 1))
active_in_args = False active_in_args = False
for a in args: for a in args:
if a[0] == 'active': if a[0] == 'active':
active_in_args = True active_in_args = True
if not active_in_args: if not active_in_args:
args.insert(0, ('active', '=', 1)) args.insert(0, ('active', '=', 1))
else: else:
args = [('active', '=', 1)] args = [('active', '=', 1)]