diff --git a/addons/account/wizard/account_invoice_send.py b/addons/account/wizard/account_invoice_send.py
index dc42d1541d6..b1d64c971e9 100644
--- a/addons/account/wizard/account_invoice_send.py
+++ b/addons/account/wizard/account_invoice_send.py
@@ -31,23 +31,23 @@ class AccountInvoiceSend(models.TransientModel):
readonly=True)
@api.model
- def default_get(self, fields):
- res = super(AccountInvoiceSend, self).default_get(fields)
- res_ids = self._context.get('active_ids')
+ def default_get(self, fields_list):
+ result = super().default_get(fields_list)
+ res_ids = self.env.context.get('active_ids')
invoices = self.env['account.move'].browse(res_ids).filtered(lambda move: move.is_invoice(include_receipts=True))
if not invoices:
raise UserError(_("You can only send invoices."))
- composer = self.env['mail.compose.message'].create({
- 'composition_mode': 'comment' if len(res_ids) == 1 else 'mass_mail',
- 'subtype_id': self.env['ir.model.data']._xmlid_to_res_id('mail.mt_comment'),
- })
- res.update({
- 'invoice_ids': res_ids,
- 'composer_id': composer.id,
- })
- return res
+ if 'invoice_ids' in fields_list and not result.get('invoice_ids'):
+ result['invoice_ids'] = res_ids
+ if 'composer_id' in fields_list and not result.get('composer_id'):
+ composer = self.env['mail.compose.message'].create({
+ 'composition_mode': 'comment' if len(res_ids) == 1 else 'mass_mail',
+ 'subtype_id': self.env['ir.model.data']._xmlid_to_res_id('mail.mt_comment'),
+ })
+ result['composer_id'] = composer.id
+ return result
@api.onchange('invoice_ids')
def _compute_composition_mode(self):
diff --git a/addons/account/wizard/account_invoice_send_views.xml b/addons/account/wizard/account_invoice_send_views.xml
index f37c5006cf4..46de03f03ed 100644
--- a/addons/account/wizard/account_invoice_send_views.xml
+++ b/addons/account/wizard/account_invoice_send_views.xml
@@ -14,10 +14,17 @@