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: res.partner

Compute Method: _compute_livechat_channel_count

Inputs Method Outputs
livechat_count_by_partner = dict(
            self.env["im_livechat.channel.member.history"]._read_group(
                domain=[("partner_id", "in", self.ids), ("livechat_member_type", "=", "visitor")],
                groupby=["partner_id"],
                aggregates=["channel_id:count_distinct"],
            )
        )
for partner in self:
            partner.livechat_channel_count = livechat_count_by_partner.get(partner, 0)

Back to entity