mrp scheduler running very slow when there exists a lot of procurement orders

Bug #963031 reported by digitalsatori(Shine IT)
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP Publisher's Warranty Team

Bug Description

when there are thounds of procurement orders, sorting on planed_date make the search query extremly slow, and it is not necessary here.

Solution:
file modified: addons/procurement/schedulers.py
Removed date sorting and also added condition to get only procurement orders in 'exceoption' state. commit for every 500 procurement order processed

- 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):
                 wf_service.trg_validate(uid, 'procurement.order', id, 'button_restart', cr)
- if use_new_cursor:
- cr.commit()
+ if (((i+1)%500 == 0) or (qty_procs == (i+1))) and use_new_cursor:
+ cr.commit()

Tags: maintenance

Related branches

Revision history for this message
digitalsatori(Shine IT) (digitalsatori) wrote :

the indent is messed up, maybe submit a patch file later on

Changed in openobject-addons:
importance: Undecided → Medium
Revision history for this message
Vishal Parmar(Open ERP) (vpa-openerp) wrote :

Hello Digitalsatori,

I have checked this issue with latest trunk and 6.1. In latest trunk , 6.1 this issue has been improved. So would you please tried with latest version. So this issue is only effect on v6.0 as well as it's not a blocking point for v6.
For these type of issues, If you have a support and maintenance contract with us then you can contact our OPW team at <email address hidden>.

Thank you for your understanding!

Changed in openobject-addons:
importance: Medium → Undecided
status: New → Won't Fix
Changed in openobject-addons:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
status: Won't Fix → New
tags: added: maintenance
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Fix already merged in stable 6 at 5169: <email address hidden>

Thanks,
Naresh

Changed in openobject-addons:
status: New → Fix Released
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.