#problem: workflow is generated error if return not integer value. procurement has subflow and workflow engine has need new resource id to call subflow.
worflow should support dict or list of new created resources to call subflow.
here problem occured from workflow engine if return non integer value from workflow action: ( when I try to return list of new created resources)
-------------
[2010-03-17 17:11:27,586] ERROR:web-services:[36]: File "/media/disk/hmo/Office/Projects/OpenERP/openobject-server/bin/workflow/workitem.py", line 53, in process
[2010-03-17 17:11:27,586] ERROR:web-services:[37]: result = _execute(cr, workitem, activity, ident, stack)
[2010-03-17 17:11:27,586] ERROR:web-services:[38]: File "/media/disk/hmo/Office/Projects/OpenERP/openobject-server/bin/workflow/workitem.py", line 130, in _execute
[2010-03-17 17:11:27,586] ERROR:web-services:[39]: assert type(id_new)==type(1) or type(id_new)==type(1L), 'Wrong return value: '+str(id_new)+' '+str(type(id_new))
[2010-03-17 17:11:27,586] ERROR:web-services:[40]: AssertionError: Wrong return value: [7L] <type 'list'>
-----------------------
code in workflow/workitem.py:
....
...
...
elif activity['kind']=='subflow':
if workitem['state']=='active': _state_set(cr, workitem, activity, 'running', ident)
if activity.get('action', False): id_new = wkf_expr.execute(cr, ident, workitem, activity)
if not (id_new): cr.execute('delete from wkf_workitem where id=%s', (workitem['id'],)) return False assert type(id_new)==type(1) or type(id_new)==type(1L), 'Wrong return value: '+str(id_new)+' '+str(type(id_new)) cr.execute('select id from wkf_instance where res_id=%s and wkf_id=%s', (id_new,activity['subflow_id'])) id_new = cr.fetchone()[0]
else: id_new = instance.create(cr, ident, activity['subflow_id']) cr.execute('update wkf_workitem set subflow_id=%s where id=%s', (id_new, workitem['id'])) workitem['subflow_id'] = id_new
if workitem['state']=='running': cr.execute("select state from wkf_instance where id=%s", (workitem['subflow_id'],))
state= cr.fetchone()[0]
if state=='complete': _state_set(cr, workitem, activity, 'complete', ident)
....
....
...
sorry I'm not expert in workflow engine but I'm think to support list or dict in this case.
#problem: workflow is generated error if return not integer value. procurement has subflow and workflow engine has need new resource id to call subflow.
worflow should support dict or list of new created resources to call subflow.
here problem occured from workflow engine if return non integer value from workflow action: ( when I try to return list of new created resources) services: [36]: File "/media/ disk/hmo/ Office/ Projects/ OpenERP/ openobject- server/ bin/workflow/ workitem. py", line 53, in process services: [37]: result = _execute(cr, workitem, activity, ident, stack) services: [38]: File "/media/ disk/hmo/ Office/ Projects/ OpenERP/ openobject- server/ bin/workflow/ workitem. py", line 130, in _execute services: [39]: assert type(id_ new)==type( 1) or type(id_ new)==type( 1L), 'Wrong return value: '+str(id_new)+' '+str(type(id_new)) services: [40]: AssertionError: Wrong return value: [7L] <type 'list'> ------- ------- -- workitem. py:
-------------
[2010-03-17 17:11:27,586] ERROR:web-
[2010-03-17 17:11:27,586] ERROR:web-
[2010-03-17 17:11:27,586] ERROR:web-
[2010-03-17 17:11:27,586] ERROR:web-
[2010-03-17 17:11:27,586] ERROR:web-
-------
code in workflow/
.... 'kind'] =='subflow' : 'state' ]=='active' :
_state_ set(cr, workitem, activity, 'running', ident) get('action' , False):
id_new = wkf_expr. execute( cr, ident, workitem, activity)
cr. execute( 'delete from wkf_workitem where id=%s', (workitem['id'],))
return False
assert type(id_ new)==type( 1) or type(id_ new)==type( 1L), 'Wrong return value: '+str(id_new)+' '+str(type(id_new))
cr.execute( 'select id from wkf_instance where res_id=%s and wkf_id=%s', (id_new, activity[ 'subflow_ id']))
id_new = cr.fetchone()[0]
id_new = instance.create(cr, ident, activity[ 'subflow_ id'])
cr. execute( 'update wkf_workitem set subflow_id=%s where id=%s', (id_new, workitem['id']))
workitem[ 'subflow_ id'] = id_new 'state' ]=='running' :
cr. execute( "select state from wkf_instance where id=%s", (workitem[ 'subflow_ id'],))
_state_ set(cr, workitem, activity, 'complete', ident)
...
...
elif activity[
if workitem[
if activity.
if not (id_new):
else:
if workitem[
state= cr.fetchone()[0]
if state=='complete':
....
....
...
sorry I'm not expert in workflow engine but I'm think to support list or dict in this case.
Thanks to listen me.