Merge lp:~serpent-consulting-services/openobject-server/SerpentCS-971627-bug-6.1 into lp:openobject-server/6.1

Proposed by Serpent Consulting Services
Status: Rejected
Rejected by: Olivier Dony (Odoo)
Proposed branch: lp:~serpent-consulting-services/openobject-server/SerpentCS-971627-bug-6.1
Merge into: lp:openobject-server/6.1
Diff against target: 30 lines (+14/-2)
1 file modified
openerp/addons/base/res/res_partner.py (+14/-2)
To merge this branch: bzr merge lp:~serpent-consulting-services/openobject-server/SerpentCS-971627-bug-6.1
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+101215@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hi,

Thanks for proposing a patch for the remaining issue, however it seems we can apply the same minimalist patch as for bug 955051 and its related merge proposal:
  https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-572802-skh/+merge/100146

This seems somewhat simpler and more readable.

Your merge proposal helped identify that we were talking about the same remaining problem, though, so it was quite useful! :-)

Thanks!

Unmerged revisions

4138. By Serpent Consulting Services

[FIX] Base : Corrected name_search() of Address

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/addons/base/res/res_partner.py'
2--- openerp/addons/base/res/res_partner.py 2012-03-21 13:55:58 +0000
3+++ openerp/addons/base/res/res_partner.py 2012-04-08 23:00:29 +0000
4@@ -367,12 +367,24 @@
5 # Searching on such a domain can be dramatically inefficient, due to the expansion made
6 # for field translations, and the handling of the disjunction by the DB engine itself.
7 # So instead, we search field by field until the search limit is reached.
8- while len(ids) < limit and fields:
9- f = fields.pop(0)
10+ # Either way, if limit is not specified, we search till all the necessary fields
11+ # have gone under the radar of search
12+
13+ def _search_address(f, ids):
14 new_ids = self.search(cr, user, [(f, operator, name)] + args, limit=limit, context=context)
15 # extend ids with the ones in new_ids that are not in ids yet (and keep order)
16 old_ids = set(ids)
17 ids.extend([id for id in new_ids if id not in old_ids])
18+ return ids
19+
20+ if limit is None:
21+ #This could have been called
22+ for f in fields:
23+ ids =_search_address(f, ids)
24+
25+ while len(ids) < limit and fields:
26+ f = fields.pop(0)
27+ ids =_search_address(f, ids)
28
29 ids = ids[:limit]
30 return self.name_get(cr, user, ids, context=context)