2021-04-27 16:44:12 +02:00
|
|
|
# Copyright 2021 Creu Blanca
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
|
|
|
|
from odoo import models
|
|
|
|
|
|
|
|
|
|
|
|
class MailMessage(models.Model):
|
|
|
|
|
2022-06-03 20:10:54 +02:00
|
|
|
_inherit = "mail.message"
|
2021-04-27 16:44:12 +02:00
|
|
|
|
2022-10-04 17:33:01 +02:00
|
|
|
def _prep_quoted_reply_body(self):
|
|
|
|
return """
|
|
|
|
<div>
|
2022-12-13 11:30:20 +01:00
|
|
|
<br/>
|
|
|
|
<br/>
|
2022-10-04 17:33:01 +02:00
|
|
|
</div>
|
|
|
|
<br/>
|
|
|
|
<blockquote style="padding-right:0px; padding-left:5px; border-left-color: #000;
|
|
|
|
margin-left:5px; margin-right:0px;border-left-width: 2px; border-left-style:solid">
|
|
|
|
From: {email_from}<br/>
|
|
|
|
Date: {date}<br/>
|
|
|
|
Subject: {subject}<br/>
|
|
|
|
{body}
|
|
|
|
</blockquote>
|
|
|
|
""".format(
|
|
|
|
email_from=self.email_from,
|
|
|
|
date=self.date,
|
|
|
|
subject=self.subject,
|
|
|
|
body=self.body,
|
|
|
|
)
|
|
|
|
|
2021-04-27 16:44:12 +02:00
|
|
|
def reply_message(self):
|
2022-10-03 11:36:03 +02:00
|
|
|
action = self.env["ir.actions.actions"]._for_xml_id(
|
|
|
|
"mail.action_email_compose_message_wizard"
|
|
|
|
)
|
2022-06-03 20:10:54 +02:00
|
|
|
action["context"] = {
|
2022-10-04 17:33:01 +02:00
|
|
|
"default_model": self.model,
|
|
|
|
"default_res_id": self.res_id,
|
2021-04-27 16:44:12 +02:00
|
|
|
"default_composition_mode": "comment",
|
2022-10-04 17:33:01 +02:00
|
|
|
"quote_body": self._prep_quoted_reply_body(),
|
2021-04-27 16:44:12 +02:00
|
|
|
"default_is_log": False,
|
|
|
|
"is_log": False,
|
2022-10-04 17:33:01 +02:00
|
|
|
"is_quoted_reply": True,
|
2021-04-27 16:44:12 +02:00
|
|
|
"default_notify": True,
|
|
|
|
"force_email": True,
|
2023-01-13 15:27:41 +01:00
|
|
|
"default_partner_ids": self.partner_ids.ids,
|
2021-04-27 16:44:12 +02:00
|
|
|
}
|
|
|
|
return action
|