diff options
| author | Olivier Dony <odo@openerp.com> | 2013-04-19 15:57:56 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2013-04-19 15:57:56 +0200 |
| commit | cfb53f1aada7a04f32fae6d30add3ef25bab5b41 (patch) | |
| tree | ea2401428a7c6b4f5567bc281a07e770ee782a53 /addons/note/note_data.xml | |
| parent | 3c5559045cbbdebe2e7347ae2ffd502c3a0b4d67 (diff) | |
[FIX] res.partner: search using 'child_of' should include inactive children
This is necessary for 2 reasons:
- when searching on Business documents the search domain will be
[('partner_id', 'child_of', 'ACME')] in order to match all
descendants, and it must match inactive children as well
- in other cases like for resolving IDs to update via store
triggers, it is necessary that 'child_of' returns inactive
children too.
The implementation is tricky because the ORM automatically
transform 'child_of' domains into recursive searches with
[('parent_id', 'in', ids)], which is the same query that the
reverse one2many 'child_ids' will also use to find contacts.
The overridden search() therefore matches this domain pattern
only when there is one criterion (to avoid side-effects in
other cases) and a dummy extra 'domain' was added to the
definition of the 'child_ids' o2m so it won't match.
The net result is that child_ids will not return inactive
children while child_of will return all descendants when
it is the only criterion. This is the expected behavior
whenever child_of is used on res.partner, because
it's safer to always show business documents.
The only side-effects will be for custom/manual search
calls with a single criterion of the form ('parent_id','in', x)
and those can be fixed by adding an extra domain
component ('active','=',True), just like child_ids does.
bzr revid: odo@openerp.com-20130419135756-2kbhwr23lygqdoob
Diffstat (limited to 'addons/note/note_data.xml')
0 files changed, 0 insertions, 0 deletions
