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
count_by_channel = dict(
            self.env["discuss.channel"]._read_group(
                [("livechat_channel_id", "in", self.ids), ("create_date", ">", "today -29d")],
                ["livechat_channel_id"],
                ["__count"],
            ),
        )
for record in self:
            record.nbr_channel = count_by_channel.get(record, 0)

Back to entity