Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to add approval workflow OpenERP 7

on 5/6/13, 4:47 AM 4,005 views

Here shows my model class which i need to add approval work flow.

class bpl_work_update(osv.osv):
    _name = "bpl.work.update"
    _description = "BPL Work Update"
    _columns = {
        'bpl_company_id':fields.many2one('res.company', 'Company', help='Company'),
        'ref_no': fields.char('Reference No', size=10,),
        'offered_date': fields.date('Offered Date'),
        # below lines are related to work update approve Workflow (i refer hr.holidays model for )
        'state': fields.selection([('draft', 'To Submit'), ('cancel', 'Cancelled'), ('confirm', 'To Approve'), ('refuse', 'Refused'), ('validate1', 'Second Approval'), ('validate', 'Approved')],
            'Status', readonly=True, track_visibility='onchange'),
        'user_id': fields.many2one('hr.employee', 'Add records', invisible=False, readonly=True),
        'manager_id': fields.many2one('hr.employee', 'First Approval', invisible=False, readonly=True),

    _defaults = {
                 'state': 'draft',
                 'user_id': lambda obj, cr, uid, context: uid,


Here shows my view.xml file (i got only lines here which are related to work flow handling )

    <button string="Approve" name="validate" states="confirm"
        type="workflow" groups="group_checkroll_user" class="oe_highlight" />
    <button string="Validate" name="second_validate" states="validate1"
        type="workflow" groups="group_checkroll_manager" class="oe_highlight" />
    <button string="Refuse" name="refuse" states="confirm,validate,validate1"
        type="workflow" groups="group_checkroll_manager" />
    <button string="Reset to New" name="set_to_draft" states="cancel,refuse"
        type="object" groups="group_checkroll_manager" />
    <field name="state" widget="statusbar" statusbar_visible="draft,confirm,validate"
        statusbar_colors='{"confirm":"blue","validate1":"blue","refuse":"red"}' />

i have no idea for how to implement this approval type work flow. i refer hr.holidays model class but unable to got clear idea about it. please help me to add level to approve my work order request. & please give me a link to refer regarding this type of work flow creating..

now that workflow buttons added to form and shows correctly.but how to handle those.? here is my screen photo


Priyesh Solanki (pso)

--Priyesh Solanki (pso)--
Tiny ERP Pvt Ltd
| 2 2 4
--Priyesh Solanki (pso)--
Priyesh Solanki (pso)
On 5/6/13, 5:20 AM

You can refer this link :


You need to create a new workflow.xml file where you need to define first Workflow for which object you are creating, Different Activities that you want to show in that workflow and Different Transitions between Activities. First you refer above link, understand it and after go for developing it.

You did right thing by assigning type="workflow" in button. Here, name of button is working as a signal in transition. It means that If your flow will get the signal, It will go for checking it in transition and from transition, it will trigger the function of that activity for which, transition is created.

Thank you proyesh, It's help me alot..

on 7/24/14, 5:56 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 5/6/13, 4:47 AM
Seen: 4005 times
Last updated: 3/16/15, 8:10 AM