[IMP] get active activities for the workflow for the record

bzr revid: ksh@openerp.co.in-20100218114034-8gcx0yxege2taaid
This commit is contained in:
ksh (Axelor) 2010-02-18 17:10:34 +05:30
parent 7b96c8e03a
commit 34d8f3faa0
1 changed files with 19 additions and 0 deletions

View File

@ -44,6 +44,25 @@ class workflow(osv.osv):
wf_service.clear_cache(cr, user)
return super(workflow, self).write(cr, user, ids, vals, context=context)
def get_active_workitems(self, cr, uid, res, res_id, context={}):
cr.execute('select * from wkf where osv=%s limit 1',(res,))
wkfinfo = cr.dictfetchone()
workitems = []
if wkfinfo:
cr.execute('SELECT id FROM wkf_instance \
WHERE res_id=%s AND wkf_id=%s \
ORDER BY state LIMIT 1',
(res_id, wkfinfo['id']))
inst_id = cr.fetchone()
cr.execute('select act_id,count(*) from wkf_workitem where inst_id=%s group by act_id', (inst_id,))
workitems = dict(cr.fetchall())
return {'wkf': wkfinfo, 'workitems': workitems}
#
# scale = (vertical-distance, horizontal-distance, min-node-width(optional), min-node-height(optional), margin(default=20))
#