openerp-chinese-team team mailing list archive
-
openerp-chinese-team team
-
Mailing list archive
-
Message #00111
lp:~openerp-chinese-team/openobject-addons/fix-inefficient-mrp-scheduler into lp:openobject-addons/6.0
digitalsatori has proposed merging lp:~openerp-chinese-team/openobject-addons/fix-inefficient-mrp-scheduler into lp:openobject-addons/6.0.
Requested reviews:
Core devs (core)
Related bugs:
Bug #963031 in OpenERP Addons: "mrp scheduler running very slow when there exists a lot of procurement orders"
https://bugs.launchpad.net/openobject-addons/+bug/963031
For more details, see:
https://code.launchpad.net/~openerp-chinese-team/openobject-addons/fix-inefficient-mrp-scheduler/+merge/99208
When there exists thousands of procurements, sorting by planed_date is extremely time consuming, and it is not necessary. removed sorting, added a domain filter, commit for every 500 procurments processed
--
https://code.launchpad.net/~openerp-chinese-team/openobject-addons/fix-inefficient-mrp-scheduler/+merge/99208
Your team Open ERP Chinese is subscribed to branch lp:~openerp-chinese-team/openobject-addons/fix-inefficient-mrp-scheduler.
=== modified file 'procurement/schedulers.py'
--- procurement/schedulers.py 2011-01-14 00:11:01 +0000
+++ procurement/schedulers.py 2012-03-25 14:30:26 +0000
@@ -53,11 +53,12 @@
procurement_obj = self.pool.get('procurement.order')
if not ids:
- ids = procurement_obj.search(cr, uid, [], order="date_planned")
- for id in ids:
+ ids = procurement_obj.search(cr, uid, [('state', '=', 'exception')])
+ qty_procs = len(ids)
+ for i, id in enumerate(ids, 1):
wf_service.trg_validate(uid, 'procurement.order', id, 'button_restart', cr)
- if use_new_cursor:
- cr.commit()
+ if ((i%500 == 0) or (qty_procs == i)) and use_new_cursor:
+ cr.commit()
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
maxdate = (datetime.today() + relativedelta(days=company.schedule_range)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT)
start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
Follow ups