social/mail_quoted_reply/models/mail_message.py

26 lines
821 B
Python
Raw Normal View History

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
def reply_message(self):
2022-06-03 20:10:54 +02:00
action = self.env.ref("mail.action_email_compose_message_wizard").read()[0]
action["context"] = {
2021-04-27 16:44:12 +02:00
"default_model": self._name,
"default_res_id": self.id,
2022-06-03 20:10:54 +02:00
"default_template_id": self.env.ref("mail_quoted_reply.reply_template").id,
2021-04-27 16:44:12 +02:00
"default_composition_mode": "comment",
"default_is_log": False,
"is_log": False,
"default_notify": True,
"force_email": True,
"reassign_to_parent": True,
2022-06-03 20:10:54 +02:00
"default_partner_ids": [(6, 0, self.partner_ids.ids)],
2021-04-27 16:44:12 +02:00
}
return action