title: How do I link Odoo clickable statusbar with the workflow?
body: <p>I have defined state actions, buttons, and the workflow. They work just fine, the problem is when I tried to add a clickable statusbar and everytime I click the status bar, it won't actually do anything other than changing the record's state.</p>
  
  <p>How do I link the statusbar to the workflow/actions?</p>
  
  <p>model.py</p>
  
  <pre><code>def action_state_draft(self, cr, uid, ids):
      self.write(cr, uid, ids, { 'state' : 'draft' })
      return True
  
  def action_state_confirmed(self, cr, uid, ids):
      self.write(cr, uid, ids, { 'state' : 'confirmed' })
      return True
  
  def action_state_posted(self, cr, uid, ids):
      self.write(cr, uid, ids, { 'state' : 'posted' })
      return True
  
  def action_state_cancelled(self, cr, uid, ids):
      self.write(cr, uid, ids, { 'state' : 'cancelled' })
      return True
  
  def hello_world(self):
      print "Hello World!"
  
  def hello_world_second(self):
      print "Hello World Second!"
  </code></pre>
  
  <p>model_view.xml</p>
  
  <pre><code>&lt;header&gt;
      &lt;button name="action_state_confirmed" string="Confirm" states="draft" /&gt;
      &lt;button name="action_state_posted" string="Post" states="confirmed" /&gt;
      &lt;button name="action_state_cancelled" string="Cancel" states="draft,confirmed,posted" /&gt;
      &lt;field name="state" widget="statusbar" clickable="True" statusbar_visible="draft,confirmed,posted,cancelled"/&gt;
  &lt;/header&gt;
  </code></pre>
  
  <p>model_workflow.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;openerp&gt;
      &lt;data&gt;      
          &lt;record id="ig_account_voucher_wkf" model="workflow"&gt;
              &lt;field name="name"&gt;ig.account.voucher.wkf&lt;/field&gt;
              &lt;field name="osv"&gt;ig.account.voucher&lt;/field&gt;
              &lt;field name="on_create"&gt;True&lt;/field&gt;
          &lt;/record&gt;
  
          &lt;record id="act_draft" model="workflow.activity"&gt;
              &lt;field name="wkf_id" ref="ig_account_voucher_wkf"/&gt;
              &lt;field name="name"&gt;draft&lt;/field&gt;
              &lt;field name="flow_start"&gt;True&lt;/field&gt;           
          &lt;/record&gt;
  
          &lt;record id="act_confirmed" model="workflow.activity"&gt;
              &lt;field name="wkf_id" ref="ig_account_voucher_wkf"/&gt;
              &lt;field name="name"&gt;confirmed&lt;/field&gt;
              &lt;field name="action"&gt;
                  write({'state':'confirmed'})
                  hello_world()
                  hello_world_second()
              &lt;/field&gt;
              &lt;field name="kind"&gt;function&lt;/field&gt;
          &lt;/record&gt;
  
          &lt;record id="act_posted" model="workflow.activity"&gt;
              &lt;field name="wkf_id" ref="ig_account_voucher_wkf"/&gt;
              &lt;field name="name"&gt;posted&lt;/field&gt;
              &lt;field name="action"&gt;write({'state':'posted'})&lt;/field&gt;
              &lt;field name="kind"&gt;function&lt;/field&gt;
          &lt;/record&gt;
  
          &lt;record id="act_posted" model="workflow.activity"&gt;
              &lt;field name="wkf_id" ref="ig_account_voucher_wkf"/&gt;
              &lt;field name="name"&gt;cancelled&lt;/field&gt;
              &lt;field name="action"&gt;write({'state':'cancelled'})&lt;/field&gt;
              &lt;field name="kind"&gt;function&lt;/field&gt;
              &lt;field name="flow_stop"&gt;True&lt;/field&gt;
          &lt;/record&gt;
  
          &lt;record id="transition_draft_confirmed" model="workflow.transition"&gt;
              &lt;field name="act_from" ref="act_draft"/&gt;
              &lt;field name="act_to" ref="act_confirmed"/&gt;
              &lt;field name="condition"&gt;True&lt;/field&gt;
              &lt;field name="signal"&gt;action_state_confirmed&lt;/field&gt;
          &lt;/record&gt;
  
          &lt;record id="transition_confirmed_posted" model="workflow.transition"&gt;
              &lt;field name="act_from" ref="act_confirmed"/&gt;
              &lt;field name="act_to" ref="act_posted"/&gt;
              &lt;field name="condition"&gt;True&lt;/field&gt;
              &lt;field name="signal"&gt;action_state_posted&lt;/field&gt;
          &lt;/record&gt;
  
          &lt;record id="transition_confirmed_cancelled" model="workflow.transition"&gt;
              &lt;field name="act_from" ref="act_confirmed"/&gt;
              &lt;field name="act_to" ref="act_posted"/&gt;
              &lt;field name="condition"&gt;True&lt;/field&gt;
              &lt;field name="signal"&gt;action_state_cancelled&lt;/field&gt;
          &lt;/record&gt;
      &lt;/data&gt;
  &lt;/openerp&gt;
  </code></pre>
  
  <p>Another relevant little question: Why do we need workflow instead of just using buttons and actions?</p>