[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 <agr-odoo@users.noreply.github.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2021-01-12 17:34:12 +00:00
parent fe5a6cc5e8
commit 543ccf2efd
@@ -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')