[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

X-original-commit: 2496125f29cf1bd5b7a37384897f49bed86e69d8
This commit is contained in:
jvm-odoo
2019-11-06 12:58:08 +00:00
parent 21d230abca
commit 9c337dac62
@@ -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):