Anaƫl Closson (openerp) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw577076-acl into 
lp:openobject-addons/6.1.

Requested reviews:
  Olivier Dony (OpenERP) (odo-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw577076-acl/+merge/122880

Forward port of 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-577076-acl/+merge/122879

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)

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw577076-acl/+merge/122880
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw577076-acl.
=== modified file 'account/account.py'
--- account/account.py	2012-08-28 07:48:35 +0000
+++ account/account.py	2012-09-05 14:10:00 +0000
@@ -249,8 +249,16 @@
                 order, context=context, count=count)
 
     def _get_children_and_consol(self, cr, uid, ids, context=None):
+		ids = [ids] if isinstance(ids,(int,float)) else ids
         #this function search for all the children and all consolidated children (recursively) of the given account ids
-        ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)
+        ids2 = set()
+        limit = 2000
+        #split the request into several smaller etc. et
+        while(ids)
+            ids2 = ids2.union(self.search(cr, uid, [('parent_id', 'child_of', ids[:limit])], context=context))
+            ids = ids[limit:]
+        #reorder the list by parent_left and delete duplicates
+        ids2 = self.search(cr, uid, [('id', 'in', list(ids2))], context=context)
         ids3 = []
         for rec in self.browse(cr, uid, ids2, context=context):
             for child in rec.child_consol_ids:

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to