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.users

Compute Method: _compute_livechat_ongoing_session_count

View 20.0
Inputs Method Outputs
  • partner_id
  • partner_id.ids
+ domain = [
+             ("channel_id.livechat_end_dt", "=", False),
+             ("member_id", "!=", False),
+             ("partner_id", "in", self.partner_id.ids),
+             ("channel_id.last_interest_dt", ">=", "-15M"),
+         ]
+ if channel_id := self.env.context.get('im_livechat_channel_id'):
+             domain.append(("session_livechat_channel_id", "=", channel_id))
+ count_by_partner = dict(
+             self.env["im_livechat.channel.member.history"]._read_group(
+                 domain, ["partner_id"], ["__count"],
+             ),
+         )
+ for user in self:
+             user.livechat_ongoing_session_count = count_by_partner.get(user.partner_id, 0)
  • livechat_ongoing_session_count

Back to entity