before this commit, if user is searching on member_ids
field in crm.team is giving an archived record also from
member_ids table.
* create a partner (Test Partner) and sales team (Test Team)
* set the created sales team for partner
* add and remove a user (A) to this sales team
* search for partners with sales team in which
user (A) is part of.
* result says that partner (Test Partner) matches the
search condition, which is wrong
In [1] we ensure that m2o relations in multipath domains
do not filter on 'active'.
However the context variable that does this will propagate
to all potential subqueries.
In this case this means 'crm_team_member_ids.user_id' on sale teams will be searched without filtering on 'active'
when it is a subquery of searching 'team_id.member_ids'. Even though searching 'crm_team_member_ids.user_id'
on its own would have filtered on 'active'.
The fix is to set the context for 'active_test' on the field directly, as we already have another field with 'active_test=False' if that is ever needed.
[1]: c15c07c405
after this commit, the search will return active records
only.
closesodoo/odoo#128563
X-original-commit: 08d4aeb0449d145a4e96565ff7e68dc856392904
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>