This question has been flagged
1 Reply
24090 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??

Avatar
Discard
Best Answer

"%(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

Avatar
Discard
Author

thanks Jaako.

Author

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

"%(purchase_requisition.action_purchase_requisition_partner)d" -
"%(module name.your action name)d"