diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index ba7dc132988..59f45735bea 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -478,26 +478,41 @@ class Post(models.Model): base_url = self.env['ir.config_parameter'].get_param('web.base.url') for post in self: if post.state == 'active' and post.parent_id: - body = _( - '

A new answer for %s has been posted. Click here to access the post.

' % - (post.parent_id.name, base_url, slug(post.parent_id.forum_id), slug(post.parent_id)) - ) + body = """ +

%(intro)s

+

+ + %(click)s + +

""" % {'intro': _('A new answer on %s has been posted. Click here to access the post :') % self.parent_id.name, + 'url': '%s/forum/%s/question/%s' % (base_url, slug(self.parent_id.forum_id), slug(self.parent_id)), + 'click': _('See post')} post.parent_id.message_post(subject=_('Re: %s') % post.parent_id.name, body=body, subtype='website_forum.mt_answer_new') elif post.state == 'active' and not post.parent_id: - body = _( - '

A new question %s has been asked on %s. Click here to access the question.

' % - (post.name, post.forum_id.name, base_url, slug(post.forum_id), slug(post)) - ) + body = """ +

%(intro)s

+

+ + %(click)s + +

""" % {'intro': _('A new question %s on %s has been posted. Click here to access the question :') % (self.name, self.parent_id.name), + 'url': '%s/forum/%s/question/%s' % (base_url, slug(self.forum_id), slug(self)), + 'click': _('See question')} post.message_post(subject=post.name, body=body, subtype='website_forum.mt_question_new') elif post.state == 'pending' and not post.parent_id: # TDE FIXME: in master, you should probably use a subtype; # however here we remove subtype but set partner_ids partners = post.message_partner_ids.filtered(lambda partner: partner.user_ids and partner.user_ids.karma >= post.forum_id.karma_moderate) note_subtype = self.sudo().env.ref('mail.mt_note') - body = _( - '

A new question %s has been asked on %s and require your validation. Click here to access the question.

' % - (post.name, post.forum_id.name, base_url, slug(post.forum_id), slug(post)) - ) + body = """ +

%(intro)s

+

+ + %(click)s + +

""" % {'intro': _('A new question %s has been asked on %s and require your validation. Click here to access the question :') % (self.name, self.parent_id.name), + 'url': '%s/forum/%s/question/%s' % (base_url, slug(self.forum_id), slug(self)), + 'click': _('Validate question')} post.message_post(subject=post.name, body=body, subtype_id=note_subtype.id, partner_ids=partners.ids) return True