From 4baa5502cf93b7a7583cdcd301333eac31047bc6 Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Mon, 11 Jan 2010 12:56:51 +0530 Subject: [PATCH] [IMP] project: now it will send project id in global context bzr revid: mra@tinyerp.com-20100111072651-1lh5et3exp96uud7 --- addons/project/project.py | 14 +++++++++++--- addons/project/project_view.xml | 5 +++-- addons/project/security/project_security.xml | 16 ++++++++-------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 4567ba1c4b0..dabed700baf 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -507,12 +507,20 @@ 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 + class users(osv.osv): _inherit = 'res.users' - _description ="User" + _description = "Users" _columns = { - 'project_id': fields.many2one('project.project', 'Project'), + 'context_project_id': fields.selection(_project_get, 'Project'), } users() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 3b4eee97adc..6590c86d827 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -670,7 +670,7 @@ menu_main - + @@ -680,9 +680,10 @@ menu_main res.users form + - + diff --git a/addons/project/security/project_security.xml b/addons/project/security/project_security.xml index 8c1be345402..e00d72ef1ce 100644 --- a/addons/project/security/project_security.xml +++ b/addons/project/security/project_security.xml @@ -46,8 +46,8 @@ = - user.project_id.id - ['|',('project_id','=',False),('project_id','=',[user.project_id.id])] + user.context_project_id.id + ['|',('project_id','=',False),('project_id','=',[user.context_project_id.id])] @@ -59,8 +59,8 @@ = - user.project_id.id - ['|',('task_id.project_id','=',False),('task_id.project_id','=',[user.project_id.id])] + user.context_project_id.id + ['|',('task_id.project_id','=',False),('task_id.project_id','=',[user.context_project_id.id])] @@ -72,8 +72,8 @@ = - user.project_id.id - ['|',('id','=',False),('id','=',[user.project_id.id])] + user.context_project_id.id + ['|',('id','=',False),('id','=',[user.context_project_id.id])] @@ -85,8 +85,8 @@ = - user.project_id.id - ['|',('project_id','=',False),('project_id','=',[user.project_id.id])] + user.context_project_id.id + ['|',('project_id','=',False),('project_id','=',[user.context_project_id.id])]