[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
This commit is contained in:
Goffin Simon
2016-06-14 17:40:44 +02:00
parent ca8a38d201
commit 133490b4d0
4 changed files with 16 additions and 5 deletions
+5
View File
@@ -119,6 +119,11 @@ class Message(models.Model):
for message in self:
message.needaction = message in my_messages
@api.multi
def _is_accessible(self):
self.ensure_one()
return False
@api.model
def _search_needaction(self, operator, operand):
if operator == '=' and operand:
-3
View File
@@ -1814,9 +1814,6 @@ 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)
+1 -2
View File
@@ -74,7 +74,6 @@ 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,
@@ -84,7 +83,7 @@ class Partner(models.Model):
'record_name': record_name,
'tracking': tracking,
'is_discussion': is_discussion,
'is_accessible': is_accessible
'is_accessible': message._is_accessible()
}
@api.model
+10
View File
@@ -792,6 +792,7 @@ class Post(models.Model):
# TDE END FIXME
if not post.can_comment:
raise KarmaError('Not enough karma to comment')
kwargs['record_name'] = kwargs.get('record_name') or post.parent_id and post.parent_id.name
return super(Post, self).message_post(cr, uid, thread_id, message_type=message_type, subtype=subtype, context=context, **kwargs)
@@ -895,3 +896,12 @@ class Tags(models.Model):
if self.env.user.karma < forum.karma_tag_create:
raise KarmaError(_('Not enough karma to create a new Tag'))
return super(Tags, self.with_context(mail_create_nolog=True, mail_create_nosubscribe=True)).create(vals)
class Message(models.Model):
_name = 'mail.message'
_inherit = ['mail.message']
@api.multi
def _is_accessible(self):
res = super(Message, self)._is_accessible()
return self.model == 'forum.post' or res