From: mra (Open ERP) Date: Mon, 18 Jan 2010 06:11:21 +0000 (+0530) Subject: [IMP] project: getting projects in user prefrence X-Git-Tag: 6.0.0-rc1-addons~1719 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=91d38b49316869f822fe136f034d4e0722643143;p=odoo%2Fodoo.git [IMP] project: getting projects in user prefrence bzr revid: mra@tinyerp.com-20100118061121-i3rdkxjmnksy1iug --- 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])]