Hello Arjun
1)first create seperate .xml file
then put this code put your model name in the place of academic.session
<?xml version="1.0"?>
<openerp>
<data>
<record model="workflow" id="wkf_academy">
<field name="name">academy.wkf</field>
<field name="osv">academic.session</field>
<field name="on_create">True</field>
</record>
<record model="workflow.activity" id="act_draft">
<field name="wkf_id" ref="wkf_academy" />
<field name="flow_start">True</field>
<field name="name">draft</field>
<field name="kind">function</field>
<field name="action">write({'state': 'draft'})</field>
</record>
<record model="workflow.activity" id="act_confirmed">
<field name="wkf_id" ref="wkf_academy" />
<field name="name">confirmed</field>
<field name="kind">function</field>
<field name="action">session_confirmed()</field>
</record>
<record model="workflow.activity" id="act_done">
<field name="wkf_id" ref="wkf_academy"/>
<field name="name">done</field>
<field name="kind">function</field>
<field name="action">session_done()</field>
</record>
<record model="workflow.transition" id="t1">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_confirmed"/>
<field name="signal">session_confirmed</field>
</record>
<record model="workflow.transition" id="t2">
<field name="act_from" ref="act_confirmed"/>
<field name="act_to" ref="act_draft" />
<field name="signal">session_draft</field>
</record>
<record model="workflow.transition" id="t3">
<field name="act_from" ref="act_confirmed"/>
<field name="act_to" ref="act_done" />
<field name="signal">session_done</field>
</record>
<record model="workflow.transition" id="t4">
<field name="act_from" ref="act_done"/>
<field name="act_to" ref="act_draft" />
<field name="signal">session_draft</field>
<field name="flow_stop">True</field>
</record>
</data>
</openerp>
2) then put the following method inside .py file in particular model that name you mention like i put my method inside academic.session model in .py file
def session_draft(self, cr, uid, ids,context=None):
self.write(cr, uid, ids, { 'state' : 'draft'},context=context)
return True
def session_confirmed(self, cr, uid, ids,context=None):
self.write(cr, uid, ids, { 'state' : 'confirmed'},context=context)
return True
def session_done(self, cr, uid, ids,context=None):
self.write(cr, uid, ids, { 'state' : 'done' },context=context)
return True
3)try to print workflow
Thank You