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: discuss.channel

Compute Method: _compute_member_count

Inputs Method Outputs
  • id
read_group_res = self.env['discuss.channel.member']._read_group(domain=[('channel_id', 'in', self.ids)], groupby=['channel_id'], aggregates=['__count'])
member_count_by_channel_id = {channel.id: count for channel, count in read_group_res}
for channel in self:
            channel.member_count = member_count_by_channel_id.get(channel.id, 0)

Back to entity