From bb633d22c53fd7b8b42bb90c5c434c0bbaa42bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20D=2E=20D=C3=ADaz?= Date: Mon, 1 Mar 2021 23:00:26 +0100 Subject: [PATCH] [FIX] mail_tracking: Store cc --- mail_tracking/models/mail_thread.py | 13 ++++++++----- mail_tracking/tests/test_mail_tracking.py | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/mail_tracking/models/mail_thread.py b/mail_tracking/models/mail_thread.py index c2718cc..cc10100 100644 --- a/mail_tracking/models/mail_thread.py +++ b/mail_tracking/models/mail_thread.py @@ -29,17 +29,20 @@ class MailThread(models.AbstractModel): ("mail_tracking_ids.state", "in", list(failed_states)), ] - @api.returns("self", lambda value: value.id) - def message_post(self, *args, **kwargs): + @api.model + def _message_route_process(self, message, message_dict, routes): """Adds CC recipient to the message. Because Odoo implementation avoid store 'from, to, cc' recipients we ensure that this information its written into the mail.message record. """ - kwargs.update( - {"email_cc": kwargs.get("cc", False), "email_to": kwargs.get("to", False)} + message_dict.update( + { + "email_cc": message_dict.get("cc", False), + "email_to": message_dict.get("to", False), + } ) - return super().message_post(*args, **kwargs) + return super()._message_route_process(message, message_dict, routes) def _message_get_suggested_recipients(self): """Adds email 'extra' recipients as suggested recipients. diff --git a/mail_tracking/tests/test_mail_tracking.py b/mail_tracking/tests/test_mail_tracking.py index 2411e8a..3ebda76 100644 --- a/mail_tracking/tests/test_mail_tracking.py +++ b/mail_tracking/tests/test_mail_tracking.py @@ -182,7 +182,7 @@ class TestMailTracking(TransactionCase): # pylint: disable=C8107 message = self.recipient.with_user(sender_user).message_post( body="

This is a test message

", - cc="Dominique Pinon , sender@example.com", + email_cc="Dominique Pinon , sender@example.com", ) # suggested recipients recipients = self.recipient._message_get_suggested_recipients() @@ -235,7 +235,7 @@ class TestMailTracking(TransactionCase): # pylint: disable=C8107 message = self.recipient.with_user(sender_user).message_post( body="

This is a test message

", - to="Dominique Pinon , sender@example.com", + email_to="Dominique Pinon , sender@example.com", ) # suggested recipients recipients = self.recipient._message_get_suggested_recipients()