summaryrefslogtreecommitdiff
path: root/openerp/workflow/instance.py
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2015-10-14 11:47:10 +0200
committerNicolas Lempereur <nle@odoo.com>2015-10-14 17:37:13 +0200
commitb0a4dd0127ddda57fd07680e6ea0a27cfb57692c (patch)
tree0f4c30eaf68dff35f1b81c6c49dc3d43a04c19f1 /openerp/workflow/instance.py
parent8ea17a8cc9ca540adbd182e71e97ff8a5fc43794 (diff)
[FIX] workflow: don't process workitem several times
In some complex use case of a workflow instance with several workitems, a given workitem processing could itself somewhat recursively process one of the following workitems. This situation was currently not taken into account, so in that given case, the already processed workitems would be processed again. opw-647580
Diffstat (limited to 'openerp/workflow/instance.py')
-rw-r--r--openerp/workflow/instance.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/openerp/workflow/instance.py b/openerp/workflow/instance.py
index eed3e984f42..f3992ed9903 100644
--- a/openerp/workflow/instance.py
+++ b/openerp/workflow/instance.py
@@ -38,8 +38,13 @@ def delete(cr, ident):
def validate(cr, inst_id, ident, signal, force_running=False):
cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id,))
stack = []
- for witem in cr.dictfetchall():
+ for i, witem in enumerate(cr.dictfetchall()):
stack = []
+ if i > 0:
+ # test if previous workitem has already processed this one
+ cr.execute("select id from wkf_workitem where id=%s", (witem['id'],))
+ if not cr.fetchone():
+ continue
workitem.process(cr, witem, ident, signal, force_running, stack=stack)
# An action is returned
_update_end(cr, inst_id, ident)