From ca8a38d201643f0be1149fc37f87c6dd93f363ff Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 14 Jun 2016 13:26:30 +0200 Subject: [PATCH] [FIX] mail: forum reply shows as 'False' When posting a comment after an answer in the forum, a mail was sent to each subscriber with 'Re: False' as title. In fact the title has to be 'Re:' + the name of the parent record of this message. When a mail is sent from the post, a link to access the subject of the forum must be included in the mail. opw:679073 --- addons/mail/data/mail_data.xml | 2 +- addons/mail/models/mail_thread.py | 3 +++ addons/mail/models/res_partner.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/mail/data/mail_data.xml b/addons/mail/data/mail_data.xml index 24d31ca23d3..44fd815a279 100644 --- a/addons/mail/data/mail_data.xml +++ b/addons/mail/data/mail_data.xml @@ -69,7 +69,7 @@ -% if not ctx['is_discussion'] or not len(ctx['actions']) == 0: +% if not ctx['is_discussion'] or not len(ctx['actions']) == 0 or ctx.get('is_accessible'):
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index a09e41af0b6..353db634554 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -1814,6 +1814,9 @@ class MailThread(models.AbstractModel): for x in ('from', 'to', 'cc'): values.pop(x, None) + if not values['subject'] and self._name == 'forum.post': + values['record_name'] = self.parent_id and self.parent_id.name + # Post the message new_message = MailMessage.create(values) diff --git a/addons/mail/models/res_partner.py b/addons/mail/models/res_partner.py index e982a5f42e3..70529c3aa4c 100644 --- a/addons/mail/models/res_partner.py +++ b/addons/mail/models/res_partner.py @@ -74,6 +74,7 @@ class Partner(models.Model): tracking_value.get_new_display_value()[0])) is_discussion = message.subtype_id.id == self.env['ir.model.data'].xmlid_to_res_id('mail.mt_comment') + is_accessible = message.model == "forum.post" return { 'signature': signature, @@ -83,6 +84,7 @@ class Partner(models.Model): 'record_name': record_name, 'tracking': tracking, 'is_discussion': is_discussion, + 'is_accessible': is_accessible } @api.model