diff --git a/addons/crm_project/crm_project_bug.py b/addons/crm_project/crm_project_bug.py index ecc1167372a..16bf0131eb7 100644 --- a/addons/crm_project/crm_project_bug.py +++ b/addons/crm_project/crm_project_bug.py @@ -43,8 +43,10 @@ class crm_project_bug(osv.osv): } def _get_project(self, cr, uid, context): - user = self.pool.get('res.users').browse(cr, uid, uid) - return user.project_id.id + user = self.pool.get('res.users').browse(cr,uid,uid, context=context) + if user.context_project_id: + return user.context_project_id.id + return False _defaults = { 'project_id':_get_project diff --git a/addons/crm_project/crm_project_feature.py b/addons/crm_project/crm_project_feature.py index dbf04814057..4301cc5ab30 100644 --- a/addons/crm_project/crm_project_feature.py +++ b/addons/crm_project/crm_project_feature.py @@ -42,8 +42,11 @@ class crm_project_future_request(osv.osv): 'project_id':fields.many2one('project.project', 'Project'), } def _get_project(self, cr, uid, context): - user = self.pool.get('res.users').browse(cr,uid,uid) - return user.project_id.id + user = self.pool.get('res.users').browse(cr,uid,uid, context=context) + if user.context_project_id: + return user.context_project_id.id + return False + _defaults = { 'project_id':_get_project } diff --git a/addons/crm_project/security/crm_project_security.xml b/addons/crm_project/security/crm_project_security.xml index 489f363ee1b..e14afc42bfc 100644 --- a/addons/crm_project/security/crm_project_security.xml +++ b/addons/crm_project/security/crm_project_security.xml @@ -10,9 +10,6 @@ - - = - user.context_project_id.id ['|',('project_id','=',False),('project_id','=',[user.context_project_id.id])] @@ -23,9 +20,6 @@ - - = - user.context_project_id.id ['|',('project_id','=',False),('project_id','=',[user.context_project_id.id])] diff --git a/addons/project/security/project_security.xml b/addons/project/security/project_security.xml index e00d72ef1ce..835ad037ee0 100644 --- a/addons/project/security/project_security.xml +++ b/addons/project/security/project_security.xml @@ -44,9 +44,6 @@ - - = - user.context_project_id.id ['|',('project_id','=',False),('project_id','=',[user.context_project_id.id])] @@ -57,9 +54,6 @@ - - = - user.context_project_id.id ['|',('task_id.project_id','=',False),('task_id.project_id','=',[user.context_project_id.id])] @@ -70,9 +64,6 @@ - - = - user.context_project_id.id ['|',('id','=',False),('id','=',[user.context_project_id.id])] @@ -83,9 +74,6 @@ - - = - user.context_project_id.id ['|',('project_id','=',False),('project_id','=',[user.context_project_id.id])]