From 543ccf2efd2f7173b2c90850baf85eb3dc53065a Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Mon, 11 Jan 2021 16:32:24 +0000 Subject: [PATCH] [FIX] account: compute composition mode before changing template From Invoice list view select 2+ invoices (A, B), click Action>send and print In each invoice 2 invoices will be sent: - In A, you'll find A and A - In B, you'll find A and B This occur because the composition_mode of the composer is computed after the attachment has been generated. When the composer has an attachment, it is included into the sent mail along the relevant one, generated on the fly for each record. opw-2428544 closes odoo/odoo#64445 X-original-commit: 9b585963a4b4f53b856b219004322232c2acf318 Signed-off-by: agr-odoo --- addons/account/wizard/account_invoice_send.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/wizard/account_invoice_send.py b/addons/account/wizard/account_invoice_send.py index f1bacc3d9d5..b9aae09e5c8 100644 --- a/addons/account/wizard/account_invoice_send.py +++ b/addons/account/wizard/account_invoice_send.py @@ -66,6 +66,7 @@ class AccountInvoiceSend(models.TransientModel): else: self.composer_id.composition_mode = 'comment' if len(res_ids) == 1 else 'mass_mail' self.composer_id.template_id = self.template_id.id + self._compute_composition_mode() self.composer_id.onchange_template_id_wrapper() @api.onchange('is_email')