To create workflow in openerp use these below step
- In academy.py file
import academy.py
- In __openerp__.py file
data:["academy.xml", "academy_workflow.xml"],
- In academy.py file
class session(osv.osv):
_name="session"
_columns={
'state':fields.selection{[
('draft', 'Draft'),
('new', 'New'),
('confirm', 'Confirm')
]
'stage', readonly=True,
}
}
_def stu_draft(self, cr, uid, ids):
self.write(cr,uid, ids,{'state':'draft'})
_def stu_new(self, cr, uid, ids):
self.write(cr,uid, ids,{'state':'new'})
- In academy.xml file
<button name="stu_draft" string="send to new" states="draft", type="wrokflow">
<button name="stu_new" string="send to confirm" states="new", type="wrokflow">
- In academy_workflow.xml file
<openerp>
<data>
<record model="workflow" id="wkf_academy">
<field name="name">Academy.wkf</field>
<field name="osv">session</field>
<field name="on_create">True</field>
</record>
<!--Workflow Activities-->
<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">stu_draft()</field>
</record>
<record model="workflow.activity" id="act_new">
<field name="wkf_id" ref="wkf_academy" />
<field name="name">New</field>
<field name="kind">function</field>
<field name="action">stu_new()</field>
</record>
<!--Workflow Transitions-->
<record model="workflow.transition" id="t1">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_new" />
<field name="signal">stu_95;new</field>
</record>
<record model="workflow.transition" id="t2">
<field name="act_from" ref="act_new" />
<field name="act_to" ref="act_assign" />
<field name="signal">stu_assign</field>
</record>
</data>
</openerp>
0 Comment(s)