diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index e46d2663a45..1ca454b6897 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -135,7 +135,7 @@ class Message(models.Model): # mainly usefull for testing notified_partner_ids = fields.Many2many( 'res.partner', 'mail_notification', string='Partners with Need Action', - context={'active_test': False}, depends=['notification_ids']) + context={'active_test': False}, depends=['notification_ids'], copy=False) needaction = fields.Boolean( 'Need Action', compute='_compute_needaction', search='_search_needaction') has_error = fields.Boolean( diff --git a/addons/test_mail/tests/test_message_post.py b/addons/test_mail/tests/test_message_post.py index c43089c7f85..49472beec66 100644 --- a/addons/test_mail/tests/test_message_post.py +++ b/addons/test_mail/tests/test_message_post.py @@ -294,6 +294,10 @@ class TestMessageNotify(TestMessagePostCommon): ) self.assertNotIn(new_notification, self.test_record.message_ids) + # notified_partner_ids should be empty after copying the message + copy = new_notification.copy() + self.assertFalse(copy.notified_partner_ids) + admin_mails = [mail for mail in self._mails if self.partner_admin.name in mail.get('email_to')[0]] self.assertEqual(len(admin_mails), 1, 'There should be exactly one email sent to admin') admin_mail_body = admin_mails[0].get('body')