Merge lp:~openerp-dev/openobject-server/7.0-perf_imp_wkf_trigger-tfr into lp:openobject-server/7.0
Status: | Needs review |
---|---|
Proposed branch: | lp:~openerp-dev/openobject-server/7.0-perf_imp_wkf_trigger-tfr |
Merge into: | lp:openobject-server/7.0 |
Diff against target: |
25 lines (+7/-1) 1 file modified
openerp/osv/orm.py (+7/-1) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-server/7.0-perf_imp_wkf_trigger-tfr |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+209927@code.launchpad.net |
Description of the change
When write is call for more then one ids, the query "SELECT id FROM wkf_instance WHERE res_id = ... AND res_type = '.....' AND state = 'active';" is called for each id in the write.
This is necessary to trigger the workflow but totally unecessary when there is no workflow for the current object.
The patch check the existance of a workflow for the object (1 query) and if there is no workflow do not call trigger_write and thus avoid calling N times the select query on wkf instance.
The improvement is small for a smal amount of records but for 5000 it can multiple the time by 3
Unmerged revisions
- 5256. By tfr (Openerp)
-
[PERF] Don't try to trigger workflow on write when there is no workflow for the current model, then avoiding unecessary o(n) query on wkf_instance