How to create new Signal Button for use in transition and form button

Asked by John Chen

Hi

I would like to create a new signal button for use in purchase order form.

This is the Workflow.XML that i created :

Workflow.XML
--------------------
<record id="purchase_order" model="workflow">
     <field name="name">Purchase Order Basic Workflow</field>
     <field name="osv">purchase.order</field>
     <field name="on_create">True</field>
</record>

 <record id="act_waitinglocalsup" model="workflow.activity">
     <field name="wkf_id" ref="purchase_order"/>
     <field name="name">waitinglocalsup</field>
     <field name="kind">function</field>
     <field name="action">wkf_waitingapproval()</field>
</record>

<record id="trans_confirmed_approve_local" model="workflow.transition">
     <field name="act_from" ref="act_waitinglocalsup"/>
     <field name="act_to" ref="act_confirmed"/>
     <field name="signal">purchase_approve_local</field>
</record>
--------------------------------------------------------------------------------------------------------------------------

And then i add a new button call purchase_approve_local in the purchase_view.XML

<button name="purchase_approve_local" string="Approved by Supervisor" type="object" icon="gtk-go-forward" states="waitinglocalsup"/>

--------------------------------------------------------------------------------------------------------------------------

so when in the purchase order states become = "waitinglocalup" it should show the purchase_approve_local button, but mine show this error :

Traceback (most recent call last):
  File "netsvc.pyo", line 489, in dispatch
  File "service\web_services.pyo", line 599, in dispatch
  File "osv\osv.pyo", line 122, in wrapper
  File "osv\osv.pyo", line 176, in execute
  File "osv\osv.pyo", line 167, in execute_cr
AttributeError: 'purchase.order' object has no attribute 'purchase_approve_local'

--------------------------------------------------------------------------------------------------------------------------

Help me thanks OpenErp Community.

John

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Web Client Edit question
Assignee:
No assignee Edit question
Solved by:
John Chen
Solved:
Last query:
Last reply:
Revision history for this message
John Chen (john-chen2011) said :
#1

<button name="purchase_approve_local" string="Approved by Supervisor" icon="gtk-go-forward" states="waitinglocalsup"/>

Note : Don't need to use type="object"

Revision history for this message
John Chen (john-chen2011) said :
#2

<button name="purchase_approve_local" string="Approved by Supervisor" icon="gtk-go-forward" states="waitinglocalsup"/>

Note : Don't need to use type="object"

Revision history for this message
Nabil Sedoud (nsedoud) said :
#3

correct : type="object" is not needed, but type="workflow" is