def create(cr, act_datas, inst_id, ident, stack): for act in act_datas: cr.execute("select nextval('wkf_workitem_id_seq')") id_new = cr.fetchone()[0] cr.execute("insert into wkf_workitem (id,act_id,inst_id,state) values (%s,%s,%s,'active')", (id_new, act['id'], inst_id)) cr.execute('select * from wkf_workitem where id=%s',(id_new,)) res = cr.dictfetchone() wkf_logs.log(cr,ident,act['id'],'active') process(cr, res, ident, stack=stack)
def _state_set(cr, workitem, activity, state, ident): """ Sets the wkf_workitem's state @param cr: database handle @param workitem: dict of the wkf_workitem to process @param activity: dict of the wkf_activity @param state: string val of what to set the state to @param ident: tuple of (uid, dotted model name, resource id ) """ cr.execute('update wkf_workitem set state=%s where id=%s', (state, workitem['id'])) workitem['state'] = state wkf_logs.log(cr, ident, activity['id'], "state_set:" + state)
def create(cr, act_datas, inst_id, ident, stack): """ Create a new workitem for the provided instance @param cr: database handle @param act_datas: cr.selected wkf_activity entries associated with wkf (flow_start=True) @param inst_id: Associated wkf_instance ID for ident @param ident: tuple of (uid, dotted model name, resource id ) @param stack: ??? For each start point of the instance in the workflow, create a new state tracker (wkf_workitem). Once the state tracker (wkf_workitem) has been created, kick it off with workitem.process to see if it needs to do anything right away """ for act in act_datas: cr.execute("select nextval('wkf_workitem_id_seq')") id_new = cr.fetchone()[0] cr.execute( "insert into wkf_workitem (id,act_id,inst_id,state) values (%s,%s,%s,'active')", (id_new, act['id'], inst_id)) cr.execute('select * from wkf_workitem where id=%s', (id_new, )) res = cr.dictfetchone() wkf_logs.log(cr, ident, act['id'], 'create:active') process(cr, res, ident, stack=stack)
def _state_set(cr, workitem, activity, state, ident): cr.execute('update wkf_workitem set state=%s where id=%s', (state,workitem['id'])) workitem['state'] = state wkf_logs.log(cr,ident,activity['id'],state)
def _state_set(cr, workitem, activity, state, ident): cr.execute("update wkf_workitem set state=%s where id=%s", (state, workitem["id"])) workitem["state"] = state wkf_logs.log(cr, ident, activity["id"], state)