Odoo Help


can anyone help me to do workflow?

Milva Joy
on 4/15/15, 7:51 AM 717 views

i want to show workflow on top of my form view ie, i want to show the state transition like draft, approve, cancel etc

Alby Antony
On 4/15/15, 7:52 AM


<button string="Verify" name="action_verify" states="draft,cancel" type="object" class="oe_highlight" />

<button string="Cancel" name="action_cancel" states="draft,verify" type="object" class="oe_highlight" />

<button string="Approve" name="action_approve" states="verify" type="object" class="oe_highlight" groups="__export__.res_groups_20,

__export__.res_groups_18, __export__.res_groups_19,base.group_erp_manager" />

<field name="state" widget="statusbar" statusbar_visible="draft,verify,done,cancel" class="oe_highlight" type="workflow"/>



name: the function name in control file

states: states in which the button need to be active

class="oe_highlight" : to give red color to the button

groups: this is used to restrict the access to a particular group of users

to get group id of a group: Select groups from settings. Select any group. Activate developer mode, retriw view meta. copy group id.

control functions/claim_management.py

def action_verify(self,cr, uid, ids, context=None):

if context is None:

context = {}

self.write(cr, uid, ids, {'state': 'verify','verified_date': time.strftime('%Y-%m-%d'),'verified_id':uid}, context=context)

return True

def action_cancel(self,cr, uid, ids, context=None):

if context is None:

context = {}

self.write(cr, uid, ids, {'state': 'cancel','cancel_date': time.strftime('%Y-%m-%d'),'cancelled_id':uid}, context=context)

return True


.write() - used to update the database value


cr- database pointer

uid- active user id

ids- id of the record which it going to be affected in the database

vals: values to be updated

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/15/15, 7:51 AM
Seen: 717 times
Last updated: 4/15/15, 7:52 AM