Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Discuss

Entity: mail.mail

Compute Method: _compute_restricted_attachments

Inputs Method Outputs
"""We might not have access to all the attachments of the emails.
        Compute the attachments we have access to,
        and the number of attachments we do not have access to.
        """
for mail_sudo, mail in zip(self.sudo(), self):
            mail.unrestricted_attachment_ids = mail.sudo(False).attachment_ids
            mail.restricted_attachment_count = len(mail_sudo.attachment_ids) - len(mail.unrestricted_attachment_ids)

Back to entity