'Tools to convert an answer (forum.post) to a comment (mail.message).
The original post is unlinked and a new comment is posted on the question
using the post create_uid as the comment\'s author.'

@api.multi
def convert_answer_to_comment(self):

    self.ensure_one()
    if (not self.parent_id):
        return self.env['mail.message']
    if (not self.can_comment_convert):
        raise KarmaError('Not    enough    karma    to    convert    an    answer    to    a    comment')
    question = self.parent_id
    values = {'author_id': self.sudo().create_uid.partner_id.id, 'body': tools.html_sanitize(self.content, sanitize_attributes=True, strip_style=True, strip_classes=True), 'message_type': 'comment', 'subtype': 'mail.mt_comment', 'date': self.create_date}
    new_message = question.with_context(mail_create_nosubscribe=True).message_post(**values)
    self.sudo().unlink()
    return new_message
