[IMP] res.partner: more selective child_of _search() hack

Makes the conditions for disabling the `active` test
on res.partner.search() more selective, to avoid
triggering it when we are not actually searching for
the children of specific parents.
(Broke base tests now that data includes an deactivated
partner)

bzr revid: odo@openerp.com-20140130162419-09tit4cyef570aze
This commit is contained in:
Olivier Dony 2014-01-30 17:24:19 +01:00
parent c3c0705203
commit 7e6be99a63
1 changed files with 2 additions and 1 deletions

View File

@ -603,7 +603,8 @@ class res_partner(osv.osv, format_address):
""" Override search() to always show inactive children when searching via ``child_of`` operator. The ORM will
always call search() with a simple domain of the form [('parent_id', 'in', [ids])]. """
# a special ``domain`` is set on the ``child_ids`` o2m to bypass this logic, as it uses similar domain expressions
if len(args) == 1 and len(args[0]) == 3 and args[0][:2] == ('parent_id','in'):
if len(args) == 1 and len(args[0]) == 3 and args[0][:2] == ('parent_id','in') \
and args[0][2] != [False]:
context = dict(context or {}, active_test=False)
return super(res_partner, self)._search(cr, user, args, offset=offset, limit=limit, order=order, context=context,
count=count, access_rights_uid=access_rights_uid)