From 94e6e8187bc0a0d1bb3015a0eb75283ee3b3a495 Mon Sep 17 00:00:00 2001 From: mcm-odoo Date: Wed, 7 Aug 2019 11:27:51 +0000 Subject: [PATCH] [FIX] account: fix send invoice mail issue This commit tries to fix the issue in the "Send Invoice" modal. Because of this issue, the recipients and body are empty. task-2032586 closes odoo/odoo#35536 Signed-off-by: oco-odoo --- addons/account/wizard/account_invoice_send.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addons/account/wizard/account_invoice_send.py b/addons/account/wizard/account_invoice_send.py index 87636b6799b..2b98c37e9a2 100644 --- a/addons/account/wizard/account_invoice_send.py +++ b/addons/account/wizard/account_invoice_send.py @@ -51,6 +51,17 @@ class AccountInvoiceSend(models.TransientModel): self.composer_id.template_id = self.template_id.id self.composer_id.onchange_template_id_wrapper() + @api.onchange('is_email') + def onchange_is_email(self): + if self.is_email: + if not self.composer_id: + res_ids = self._context.get('active_ids') + self.composer_id = self.env['mail.compose.message'].create({ + 'composition_mode': 'comment' if len(res_ids) == 1 else 'mass_mail', + 'template_id': self.template_id.id + }) + self.composer_id.onchange_template_id_wrapper() + @api.onchange('is_email') def _compute_invoice_without_email(self): for wizard in self: