From d6e93d063b2fc630c3fb9db6c52e9656d8410cff Mon Sep 17 00:00:00 2001
From: Denis Ledoux <dle@odoo.com>
Date: Thu, 9 Jun 2016 18:24:12 +0200
Subject: [PATCH] [FIX] project: project duplicate message followers

This is related to revision
c8aac116a688a83050bb88bd5a5eed07eb895138

`message_follower_ids` is a one2many field
on the thread. To copy them, you must
create new `mail.followers` records, and not
linking the followers of the project
being duplicated to the duplicated project.
---
 addons/project/project.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/addons/project/project.py b/addons/project/project.py
index 2a56f437c6b3..f3b4c4c7f285 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -255,8 +255,9 @@ class project(osv.osv):
         proj = self.browse(cr, uid, id, context=context)
         if not default.get('name'):
             default.update(name=_("%s (copy)") % (proj.name))
-        default['message_follower_ids'] = [(6, 0, proj.message_follower_ids.ids)]
         res = super(project, self).copy(cr, uid, id, default, context)
+        for follower in proj.message_follower_ids:
+            self.message_subscribe(cr, uid, res, partner_ids=[follower.partner_id.id], subtype_ids=[subtype.id for subtype in follower.subtype_ids])
         self.map_tasks(cr, uid, id, res, context=context)
         return res
 
-- 
GitLab