Odoo Help

Welcome!

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.

0

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

By
Alcaline
on 8/5/14, 9:56 PM 1,014 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??

0
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>
        </record>

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.

Alcaline
on 8/13/14, 11:34 PM

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

Alcaline
on 8/13/14, 11:40 PM

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)

Stats

Asked: 8/5/14, 9:56 PM
Seen: 1014 times
Last updated: 3/16/15, 8:10 AM