[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) <tde@openerp.com>
This commit is contained in:
Jérémy Hennecart
2021-08-26 15:18:01 +00:00
parent 1d20e9780c
commit c9870c73dd
+4 -1
View File
@@ -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.'))