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_chatbot_script_count

Inputs Method Outputs
  • id
data = self.env['im_livechat.channel.rule']._read_group(
            [('channel_id', 'in', self.ids)], ['channel_id'], ['chatbot_script_id:count_distinct'])
mapped_data = {channel.id: count_distinct for channel, count_distinct in data}
for channel in self:
            channel.chatbot_script_count = mapped_data.get(channel.id, 0)

Back to entity