Low ORM write performance - checking worklfow

Bug #1176900 reported by Łukasz Herok
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

The problem is in updating many resource in one, fast update.

The problem is in write() method. It make one, nice, fast update on all resources, but then check every resource about its workflow, one by one, what takes really long time.

In the end of the write() method, is called step_workflow(), which works on every resource individually.

Example situation:

class wyn_wyn(osv.osv):
    """ Wyn """
    _name = 'wyn.wyn'
    _columns = {
                'title' : fields.char('Title', size=20, required=True),
                'savings' : fields.float('Planned savings', digits=(12,2)),
                'state': fields.selection([('draft', 'New'), ('accepted', 'Accepted'), ('refused', 'Refused')],
                        'Status', readonly=True, track_visibility='onchange')
                }

Wizard, that calculates savings (let's say now set on 123):

def calculate(self, cr, uid, ids, context=None):
           wyn = self.pool.get("wyn.wyn");
           ids = wyn.search(cr, uid, '')
           wyn.write(cr, uid, ids, {'savings' : 123})
           return {'type': 'ir.actions.act_window_close'}

Write() method does one nice update, and then ask every resource about workflow. Resulting in queries for each resource:

select * from wkf_workitem where inst_id=8056
select * from wkf_activity where id=5
select * from wkf_transition where act_from=5
select wkf_id from wkf_instance where id=8056
select state,flow_stop from wkf_workitem w left join wkf_activity a on (a.id=w.act_id) where w.inst_id=8056

Possible solutions:
- parameter to write() method to disable checking workflow
- group searching for workflows which need to make transition

Question about this issue was previously asked at:
http://help.openerp.com/question/13812/how-to-speed-up-orm-write-method-by-disabling-workflow/

description: updated
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.