From 76a1fc90e9444af66eaa9efe536fa83d0cfea0e2 Mon Sep 17 00:00:00 2001 From: "Nimesh (Open ERP)" Date: Mon, 24 Sep 2012 13:03:47 +0530 Subject: [PATCH 1/3] [ADD] followers of the project are auto follower of task bzr revid: nco@tinyerp.com-20120924073347-dotwb5mifv4r7ap6 --- addons/project/project.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/project/project.py b/addons/project/project.py index f15656905ca..ae21d51a273 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -1100,6 +1100,13 @@ class task(base_stage, osv.osv): def create(self, cr, uid, vals, context=None): task_id = super(task, self).create(cr, uid, vals, context=context) + project_obj = self.pool.get("project.project") + project_id = self.browse(cr, uid, task_id, context=context).project_id + print "project_id" + if project_id: + follower_ids = project_obj.browse(cr, uid, project_id.id, context=context).message_follower_ids + followers = [follower.id for follower in follower_ids] + self.message_subscribe(cr, uid, task_id, followers, context=context) self._store_history(cr, uid, [task_id], context=context) self.create_send_note(cr, uid, [task_id], context=context) return task_id From 380b9040c509cd43d1e081de1ae566ab09dda27c Mon Sep 17 00:00:00 2001 From: "Nimesh (Open ERP)" Date: Mon, 24 Sep 2012 14:14:56 +0530 Subject: [PATCH 2/3] [ADD] followers of the project are auto follower of issue bzr revid: nco@tinyerp.com-20120924084456-5avy6a5nf1x32uwr --- addons/project/project.py | 1 - addons/project_issue/project_issue.py | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index ae21d51a273..30f706d69d3 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -1102,7 +1102,6 @@ class task(base_stage, osv.osv): task_id = super(task, self).create(cr, uid, vals, context=context) project_obj = self.pool.get("project.project") project_id = self.browse(cr, uid, task_id, context=context).project_id - print "project_id" if project_id: follower_ids = project_obj.browse(cr, uid, project_id.id, context=context).message_follower_ids followers = [follower.id for follower in follower_ids] diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 6121acbd607..27d1d9d0a15 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -381,6 +381,11 @@ class project_issue(base_stage, osv.osv): def create(self, cr, uid, vals, context=None): obj_id = super(project_issue, self).create(cr, uid, vals, context=context) + project_obj = self.pool.get("project.project") + project_id = self.browse(cr, uid, obj_id, context=context).project_id + follower_ids = project_obj.browse(cr, uid, project_id.id, context=context).message_follower_ids + followers = [follower.id for follower in follower_ids] + self.message_subscribe(cr, uid, obj_id, followers, context=context) self.create_send_note(cr, uid, [obj_id], context=context) return obj_id From cbb3407f262221dee47021a17c2e8d473716cbd2 Mon Sep 17 00:00:00 2001 From: "Nimesh (Open ERP)" Date: Mon, 24 Sep 2012 16:44:49 +0530 Subject: [PATCH 3/3] [IMP] improve code. bzr revid: nco@tinyerp.com-20120924111449-ovy2a2bel0vn6jm6 --- addons/project/project.py | 3 +-- addons/project_issue/project_issue.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 30f706d69d3..7a73778b469 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -1100,10 +1100,9 @@ class task(base_stage, osv.osv): def create(self, cr, uid, vals, context=None): task_id = super(task, self).create(cr, uid, vals, context=context) - project_obj = self.pool.get("project.project") project_id = self.browse(cr, uid, task_id, context=context).project_id if project_id: - follower_ids = project_obj.browse(cr, uid, project_id.id, context=context).message_follower_ids + follower_ids = self.pool.get("project.project").browse(cr, uid, project_id.id, context=context).message_follower_ids followers = [follower.id for follower in follower_ids] self.message_subscribe(cr, uid, task_id, followers, context=context) self._store_history(cr, uid, [task_id], context=context) diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 27d1d9d0a15..10a879ffdc0 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -381,9 +381,8 @@ class project_issue(base_stage, osv.osv): def create(self, cr, uid, vals, context=None): obj_id = super(project_issue, self).create(cr, uid, vals, context=context) - project_obj = self.pool.get("project.project") project_id = self.browse(cr, uid, obj_id, context=context).project_id - follower_ids = project_obj.browse(cr, uid, project_id.id, context=context).message_follower_ids + follower_ids = self.pool.get("project.project").browse(cr, uid, project_id.id, context=context).message_follower_ids followers = [follower.id for follower in follower_ids] self.message_subscribe(cr, uid, obj_id, followers, context=context) self.create_send_note(cr, uid, [obj_id], context=context)