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: chatbot.script

Compute Method: _compute_livechat_channel_count

Inputs Method Outputs
  • id
channels_data = self.env['im_livechat.channel.rule']._read_group(
            [('chatbot_script_id', 'in', self.ids)], ['chatbot_script_id'], ['channel_id:count_distinct'])
mapped_channels = {chatbot_script.id: count_distinct for chatbot_script, count_distinct in channels_data}
for script in self:
            script.livechat_channel_count = mapped_channels.get(script.id, 0)

Back to entity