From 91d38b49316869f822fe136f034d4e0722643143 Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Mon, 18 Jan 2010 11:41:21 +0530 Subject: [PATCH] [IMP] project: getting projects in user prefrence bzr revid: mra@tinyerp.com-20100118061121-i3rdkxjmnksy1iug --- addons/project/project.py | 9 ++++----- addons/project/security/project_security.xml | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 555f4c6..8bd78c1 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -508,11 +508,10 @@ class message(osv.osv): message() def _project_get(self, cr, uid, context={}): - obj = self.pool.get('project.project') - ids = obj.search(cr, uid, []) - res = obj.read(cr, uid, ids, ['id','name'], context) - res = [(str(r['id']),r['name']) for r in res] - return res + cr.execute("""SELECT to_char(id, '99999'),name FROM project_project where manager=%s OR + id IN (SELECT project_id from project_user_rel where uid=%s)""" % (uid, uid)) + projects = cr.fetchall() + return projects class users(osv.osv): _inherit = 'res.users' diff --git a/addons/project/security/project_security.xml b/addons/project/security/project_security.xml index 064b9be..6d862a8 100644 --- a/addons/project/security/project_security.xml +++ b/addons/project/security/project_security.xml @@ -44,7 +44,7 @@ - ['|',('project_id','=',False),('project_id','=',user.context_project_id)] + ['|',('project_id','=',False),('project_id','in',[user.context_project_id])] @@ -54,7 +54,7 @@ - ['|',('task_id.project_id','=',False),('task_id.project_id','=',user.context_project_id)] + ['|',('task_id.project_id','=',False),('task_id.project_id','in',[user.context_project_id])] @@ -64,7 +64,7 @@ - ['|',('id','=',False),('id','=',user.context_project_id)] + ['|',('id','=',False),('id','in',[user.context_project_id])] @@ -74,7 +74,7 @@ - ['|',('project_id','=',False),('project_id','=',user.context_project_id)] + ['|',('project_id','=',False),('project_id','in',[user.context_project_id])] -- 1.7.10.4