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.


can anyone help me to do workflow?

Milva Joy
on 4/15/15, 7:51 AM 380 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

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: 4/15/15, 7:51 AM
Seen: 380 times
Last updated: 4/15/15, 7:52 AM