Merge lp:~xmo-deactivatedaccount/openerp-client-lib/search_read-shortcut-ids into lp:openerp-client-lib

Proposed by Xavier (Open ERP)
Status: Merged
Merged at revision: 34
Proposed branch: lp:~xmo-deactivatedaccount/openerp-client-lib/search_read-shortcut-ids
Merge into: lp:openerp-client-lib
Diff against target: 10 lines (+1/-0)
1 file modified
openerplib/main.py (+1/-0)
To merge this branch: bzr merge lp:~xmo-deactivatedaccount/openerp-client-lib/search_read-shortcut-ids
Reviewer Review Type Date Requested Status
Nicolas Vanhoren (OpenERP) Pending
Review via email: mp+78447@code.launchpad.net

Description of the change

In `search_read`, if the caller just asks for the id field there's no need to perform a `read` (ids are already available)

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerplib/main.py'
2--- openerplib/main.py 2011-09-29 11:54:41 +0000
3+++ openerplib/main.py 2011-10-06 17:08:36 +0000
4@@ -394,6 +394,7 @@
5 :return: A list of dictionaries containing all the specified fields.
6 """
7 record_ids = self.search(domain or [], offset, limit or False, order or False, context or {})
8+ if field == ['id']: return [{'id': record_id} for record_id in record_ids]
9 records = self.read(record_ids, fields or [], context or {})
10 return records
11

Subscribers

People subscribed via source and target branches

to all changes: