odoo/odoo#162357

Created by Matthieu Stockbauer (tsm)
label
odoo-dev:17.0-im_livechat-fix_get_less_active_operator-tsm
head
aa7acf56477ca54710c6580a7690fcc25fc517b3
target
17.0
merged
1 month ago by Matthieu Stockbauer (tsm)
forward-ports

[FIX] im_livechat: fix operator assignation

Before this PR, trying to get an available operator could result in an
error.

When a live chat is created, an operator is selected based on various
criteria such as language, country, number of ongoing chats and
availability for calls. This selection process involves the
`_get_less_active_operator` method, which receives the status of all
operators and a list of operators to choose from.

Prior to this fix, an operator not included in the list of operators
to choose from could still be selected, resulting in errors when
trying to locate them in the operator list.

This PR resolves the issue by ensuring that operators are only
selected from the provided list.

opw-3874872