[FIX] project: fix issue when subscribing people

Using the right field name is better.
This commit is contained in:
Thibault Delavallée
2017-04-11 15:26:27 +02:00
parent 6afea0b96a
commit f3cff93f5c
+1 -1
View File
@@ -270,7 +270,7 @@ class Project(models.Model):
def message_subscribe(self, partner_ids=None, channel_ids=None, subtype_ids=None, force=True):
""" Subscribe to all existing active tasks when subscribing to a project """
res = super(Project, self).message_subscribe(partner_ids=partner_ids, channel_ids=channel_ids, subtype_ids=subtype_ids, force=force)
if not subtype_ids or any(subtype.parent_id.model == 'project.task' for subtype in self.env['mail.message.subtype'].browse(subtype_ids)):
if not subtype_ids or any(subtype.parent_id.res_model == 'project.task' for subtype in self.env['mail.message.subtype'].browse(subtype_ids)):
for partner_id in partner_ids or []:
self.mapped('tasks').filtered(lambda task: not task.stage_id.fold and partner_id not in task.message_partner_ids.ids).message_subscribe(
partner_ids=[partner_id], channel_ids=None, subtype_ids=None, force=False)