Merge lp:~openerp-dev/openobject-addons/6.1-opw577076-acl into lp:openobject-addons/6.1

Proposed by Anaël Closson (openerp)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw577076-acl
Merge into: lp:openobject-addons/6.1
Diff against target: 21 lines (+9/-1)
1 file modified
account/ (+9/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw577076-acl
Reviewer Review Type Date Requested Status
Olivier Dony (Odoo) Pending
Review via email:

Description of the change

Forward port of

Allows the general ledger to be printed when more than 10000 financial account registerd.

Reproduce :
Create more or less 10000 financial accounts
Print the general ledger.

Should crash without the patch within a minute, should not crash with the patch (but still takes lot of time)

To post a comment you must log in.
Revision history for this message
Bern Schneider (mia-11ngola) wrote :

but still takes lot of time????

No solution about that?

Unmerged revisions

6976. By Anaël Closson (openerp)

[FIX] OPW 577076 Allows general ledger to be computed when lots of financial accounts (>~10000) are created.
The request computed for searching accounts that should be included in the general ledger, including their children was too big for (default?) installs of PostgreSQL.
The request is now split and can be handled by PostgreSQL. Forward port from 6.0.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/'
2--- account/ 2012-08-28 07:48:35 +0000
3+++ account/ 2012-09-05 14:10:00 +0000
4@@ -249,8 +249,16 @@
5 order, context=context, count=count)
7 def _get_children_and_consol(self, cr, uid, ids, context=None):
8+ ids = [ids] if isinstance(ids,(int,float)) else ids
9 #this function search for all the children and all consolidated children (recursively) of the given account ids
10- ids2 =, uid, [('parent_id', 'child_of', ids)], context=context)
11+ ids2 = set()
12+ limit = 2000
13+ #split the request into several smaller etc. et
14+ while(ids)
15+ ids2 = ids2.union(, uid, [('parent_id', 'child_of', ids[:limit])], context=context))
16+ ids = ids[limit:]
17+ #reorder the list by parent_left and delete duplicates
18+ ids2 =, uid, [('id', 'in', list(ids2))], context=context)
19 ids3 = []
20 for rec in self.browse(cr, uid, ids2, context=context):
21 for child in rec.child_consol_ids: