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

Module: Live Chat

Entity: im_livechat.channel

Compute Method: _compute_nbr_channel

Inputs Method Outputs
  • id
data = self.env['discuss.channel']._read_group([
            ('livechat_channel_id', 'in', self.ids),
        ], ['livechat_channel_id'], ['__count'])
channel_count = {livechat_channel.id: count for livechat_channel, count in data}
for record in self:
            record.nbr_channel = channel_count.get(record.id, 0)

Back to entity