[NEW] mail_message_copy_in_partner

This commit is contained in:
clementthomas
2024-06-27 14:40:34 +02:00
parent b636093219
commit 5312b8383f
5 changed files with 159 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import mail_thread

View File

@@ -0,0 +1,14 @@
from odoo import api, models, _
class MailThread(models.AbstractModel):
_inherit = 'mail.thread'
@api.returns('mail.message', lambda value: value.id)
def message_post(self, body='', **kwargs):
#send message to related partner
if hasattr(self, 'partner_id') and self.partner_id:
msg = _('<b>[%(object)s]</b> %(body)s',object=self._get_html_link(), body=body)
self.partner_id.message_post(body=msg, **kwargs)
return super(MailThread, self).message_post(body=body, **kwargs)