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.thread

Compute Method: _compute_has_message

Inputs Method Outputs
  • id
self.env['mail.message'].flush_model()
self.env.cr.execute("""
            SELECT distinct res_id
              FROM mail_message mm
             WHERE res_id = any(%s)
               AND mm.model=%s
        """, [self.ids, self._name])
channel_ids = {r[0] for r in self.env.cr.fetchall()}
for record in self:
            record.has_message = record.id in channel_ids

Back to entity