From 7e6be99a632070f4ead17e94641a1313d26e2dd4 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 30 Jan 2014 17:24:19 +0100 Subject: [PATCH] [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 --- openerp/addons/base/res/res_partner.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openerp/addons/base/res/res_partner.py b/openerp/addons/base/res/res_partner.py index fe38dc89062..abfa4d3efc0 100644 --- a/openerp/addons/base/res/res_partner.py +++ b/openerp/addons/base/res/res_partner.py @@ -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)