Odoo Help


how to create a BUTTON with a type="action"? Any sample for this and explanation how this works?

on 8/5/14, 9:56 PM 1,869 views

I need to know how to create the BUTTON with a TYPE of ACTION?

          <button name="%(purchase_requisition.action_purchase_requisition_partner)d" type="action"
                                        string="Request a Quotation" icon="gtk-execute"
                                        attrs="{'invisible': [('line_ids','=',False),('state', 'not in', ('in_progress'))]}"/>

"%(purchase_requisition.action_purchase_requisition_partner)d": where this came from? and how to call the def that you create for this button??

Jaakko Komulainen
On 8/6/14, 2:15 AM

"%(purchase_requisition.action_purchase_requisition_partner)d": where this came from?

That is the id of the action that the button calls. That action is defined in purchase_requisition model (purchase_requisition/wizard/purchase_requisition_partner_view.xml)

 <record id="action_purchase_requisition_partner" model="ir.actions.act_window">
               <field name="name">Purchase Requisition</field>
               <field name="type">ir.actions.act_window</field>
               <field name="res_model">purchase.requisition.partner</field>
               <field name="view_type">form</field>
               <field name="view_mode">form</field>
               <field name="context">{'record_id' : active_id}</field>
               <field name="target">new</field>

If you want to call some method defined in a python file, you need to use button with type of 'object'. See:  http://openerp-server.readthedocs.org/en/latest/03_module_dev_03.html#button

thanks Jaako.

on 8/13/14, 11:34 PM

how can i get this one "%(purchase_requisition.action_purchase_requisition_partner)d"??

on 8/13/14, 11:40 PM

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: 8/5/14, 9:56 PM
Seen: 1869 times
Last updated: 3/16/15, 8:10 AM