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_remaining_session_capacity

Inputs Method Outputs
count = self._get_ongoing_session_count_by_agent_livechat_channel()
for channel in self:
            users = channel.user_ids
            if channel.block_assignment_during_call:
                users = users.filtered(lambda u: not u.livechat_is_in_call)
            total_capacity = channel.max_sessions * len(users)
            capacity = total_capacity - sum(
                count.get((user.partner_id, channel), 0) for user in users
            )
            channel.remaining_session_capacity = max(capacity, 0)

Back to entity