[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
This commit is contained in:
parent
8ea17a8cc9
commit
b0a4dd0127
|
@ -38,8 +38,13 @@ def delete(cr, ident):
|
||||||
def validate(cr, inst_id, ident, signal, force_running=False):
|
def validate(cr, inst_id, ident, signal, force_running=False):
|
||||||
cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id,))
|
cr.execute("select * from wkf_workitem where inst_id=%s", (inst_id,))
|
||||||
stack = []
|
stack = []
|
||||||
for witem in cr.dictfetchall():
|
for i, witem in enumerate(cr.dictfetchall()):
|
||||||
stack = []
|
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)
|
workitem.process(cr, witem, ident, signal, force_running, stack=stack)
|
||||||
# An action is returned
|
# An action is returned
|
||||||
_update_end(cr, inst_id, ident)
|
_update_end(cr, inst_id, ident)
|
||||||
|
|
Loading…
Reference in New Issue