From c9870c73dd369d60fccaa597b2dd83a6bf704868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Hennecart?= Date: Fri, 20 Aug 2021 12:31:52 +0000 Subject: [PATCH] [FIX] mass_mailing: fix send with batch This commit fixes a behavior when we send a batch of mailings with no recipients. When there is no recipients passed down, each mailing should use it's own recipients and not the recipients of the first mailing. closes odoo/odoo#75652 X-original-commit: 88d74fde5ce1ec70a88679429fda02180ce7fa81 Signed-off-by: Thibault Delavallee (tde) --- addons/mass_mailing/models/mailing.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/mass_mailing/models/mailing.py b/addons/mass_mailing/models/mailing.py index 8002e1f02f0..ad7334ff096 100644 --- a/addons/mass_mailing/models/mailing.py +++ b/addons/mass_mailing/models/mailing.py @@ -666,8 +666,11 @@ class MassMailing(models.Model): def action_send_mail(self, res_ids=None): author_id = self.env.user.partner_id.id + # If no recipient is passed, we don't want to use the recipients of the first + # mailing for all the others + initial_res_ids = res_ids for mailing in self: - if not res_ids: + if not initial_res_ids: res_ids = mailing._get_remaining_recipients() if not res_ids: raise UserError(_('There are no recipients selected.'))