diff --git a/bin/workflow/workitem.py b/bin/workflow/workitem.py index 5fbf7ee7fe3..c4774a8c420 100644 --- a/bin/workflow/workitem.py +++ b/bin/workflow/workitem.py @@ -70,10 +70,10 @@ def process(cr, workitem, ident, signal=None, force_running=False): for trans in alltrans: if trans['trigger_model']: ids = wkf_expr._eval_expr(cr,ident,workitem,trans['trigger_expr_id']) - for id in ids: - cr.execute('select nextval(\'wkf_workitem_id_seq\')') + for res_id in ids: + cr.execute('select nextval(\'wkf_triggers_id_seq\')') id =cr.fetchone()[0] - cr.execute('insert into wkf_triggers (model,res_id,instance_id,workitem_id,id) values (%s,%d,%d,%d,%d)', (trans['trigger_model'],id,workitem['inst_id'], workitem['id'], id)) + cr.execute('insert into wkf_triggers (model,res_id,instance_id,workitem_id,id) values (%s,%d,%d,%d,%d)', (trans['trigger_model'],res_id,workitem['inst_id'], workitem['id'], id)) return True