From d5445c2cc1ac32f5927db399272b2e5cb9474c24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 27 Jul 2021 13:30:25 +0000 Subject: [PATCH] [FIX] mail, website_sale: remove unnecessary autofollow When sending an email on an activity or a recovery email it is not necessary to automatically include all recipients as follower. If they perform an action on the record they will be added as follower. Same if they reply. Task-2612911 PR odoo/odoo#60792 --- addons/mail/models/mail_activity.py | 2 +- addons/website_sale/models/mail_compose_message.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/mail/models/mail_activity.py b/addons/mail/models/mail_activity.py index 12add3ec5d4..c7d510ecd5e 100644 --- a/addons/mail/models/mail_activity.py +++ b/addons/mail/models/mail_activity.py @@ -1082,7 +1082,7 @@ class MailActivityMixin(models.AbstractModel): template = self.env['mail.template'].browse(template_id).exists() if not template: return False - for record in self.with_context(mail_post_autofollow=self.env.context.get('mail_post_autofollow', True)): + for record in self: record.message_post_with_template( template_id, composition_mode='comment' diff --git a/addons/website_sale/models/mail_compose_message.py b/addons/website_sale/models/mail_compose_message.py index cde56b06cf0..b38c15a3db5 100644 --- a/addons/website_sale/models/mail_compose_message.py +++ b/addons/website_sale/models/mail_compose_message.py @@ -16,5 +16,4 @@ class MailComposeMessage(models.TransientModel): ('cart_recovery_email_sent', '=', False), ('is_abandoned_cart', '=', True) ]).write({'cart_recovery_email_sent': True}) - self = self.with_context(mail_post_autofollow=self.env.context.get('mail_post_autofollow', True)) return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit)