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.call.artifact

Compute Method: _compute_media_id

Inputs Method Outputs
  • id
attachments = self.env["ir.attachment"].search_fetch([
            ("res_model", "=", self._name),
            ("res_id", "in", self.ids),
        ], ['res_id'])
attachment_by_res_id = attachments.grouped('res_id')
for artifact in self:
            artifact.media_id = attachment_by_res_id.get(artifact.id)

Back to entity