Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create workflow in openerp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 216
    Comment on it

    To create workflow in openerp use these below step

    1. In academy.py file
      import academy.py
    
    1. In __openerp__.py file
     data:["academy.xml", "academy_workflow.xml"],
    
    1. 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'})
    
    1. 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">
    
    1. 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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: