From 2496125f29cf1bd5b7a37384897f49bed86e69d8 Mon Sep 17 00:00:00 2001 From: jvm-odoo <jvm@odoo.com> Date: Mon, 4 Nov 2019 12:07:45 +0000 Subject: [PATCH] [FIX] account: fix mass mail wizard - In the sales or accounting module, create some invoices. - Select them then click on `action > send & print` - The wizard opens but not in the mass mail mode. It creates some inconsistency and if you click on send, the invoices are sent to the wrong customer. Sometimes, the invoices are not sent at all. I think the problem comes from the `_compute_composition_mode` method who set the value of `composition_mode` on the wizard instead of on the composer. OPW-2085837 --- addons/account/wizard/account_invoice_send.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/account/wizard/account_invoice_send.py b/addons/account/wizard/account_invoice_send.py index 99d745ff94b9..ce4dab563178 100644 --- a/addons/account/wizard/account_invoice_send.py +++ b/addons/account/wizard/account_invoice_send.py @@ -44,13 +44,14 @@ class AccountInvoiceSend(models.TransientModel): @api.onchange('invoice_ids') def _compute_composition_mode(self): for wizard in self: - wizard.composition_mode = 'comment' if len(wizard.invoice_ids) == 1 else 'mass_mail' + wizard.composer_id.composition_mode = 'comment' if len(wizard.invoice_ids) == 1 else 'mass_mail' @api.onchange('template_id') def onchange_template_id(self): - if self.composer_id: - self.composer_id.template_id = self.template_id.id - self.composer_id.onchange_template_id_wrapper() + for wizard in self: + if wizard.composer_id: + wizard.composer_id.template_id = wizard.template_id.id + wizard.composer_id.onchange_template_id_wrapper() @api.onchange('is_email') def onchange_is_email(self): -- GitLab