# Copyright 2021 Creu Blanca # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import models class MailMessage(models.Model): _inherit = "mail.message" def _prep_quoted_reply_body(self): return """
From: {email_from}""".format( email_from=self.email_from, date=self.date, subject=self.subject, body=self.body, ) def reply_message(self): action = self.env["ir.actions.actions"]._for_xml_id( "mail.action_email_compose_message_wizard" ) action["context"] = { "default_model": self.model, "default_res_id": self.res_id, "default_composition_mode": "comment", "quote_body": self._prep_quoted_reply_body(), "default_is_log": False, "is_log": False, "is_quoted_reply": True, "default_notify": True, "force_email": True, "default_partner_ids": self.partner_ids.ids, } return action
Date: {date}
Subject: {subject}
{body}