social/mail_attach_existing_attach.../wizard/account_invoice_send.py

23 lines
709 B
Python

# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class AccountInvoiceSend(models.TransientModel):
_inherit = "account.invoice.send"
@api.model
def default_get(self, fields_list):
res = super().default_get(fields_list)
if (
res.get("res_id")
and res.get("model")
and res.get("composition_mode", "") != "mass_mail"
and not res.get("can_attach_attachment")
):
res["can_attach_attachment"] = True # pragma: no cover
return res
can_attach_attachment = fields.Boolean(string="Can Attach Attachment",)