Odoo Help

0

how to set a button click to call a menu item?

By
aneesh ATEES Infomedia Pvt Ltd
on 1/4/16, 6:28 AM 1,392 views

i want to set a button click to invoke a menu ?that mean wen click on the  button test then load the test.menu ..how can i done this?

2
Jignesh Mehta
On 1/4/16, 6:47 AM

Hello Aneesh,


Give menu action to the button.


Ex:-

<button name="%(sale.action_order)d" string="test" type="action" class="oe_highlight" />


When we click on this button, Sale order menu will open.


Or Try This :-

<button name="action_view_menu" string="test" type="object" class="oe_highlight" />


In Py :-

     @api.multi

     def action_view_menu(self):

         action = self.env.ref('sale.action_order)

         result = action.read()[0]

         return result


Hope this works for you.


Thanks,



can u pls explain this code?

aneesh ATEES Infomedia Pvt Ltd
on 1/4/16, 10:52 PM

When you click on the button, it refers to action of sale order and open the sale order.

Jignesh Mehta
on 1/4/16, 10:58 PM
0

We know that with a menu an action is associated and based on that 'action' system performs the task. So for your requirement we can call it other way round and on button click we can return the appropriate action.

For example, you can search in odoo code here:

addons -> event -> models -> event.py : method name : action_event_registration_report

Here it tries to search for an 'action' and return the 'action'.

OR

You can create the button of type 'action'


Hope this helps !!.


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.

Register

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)

Stats

Asked: 1/4/16, 6:28 AM
Seen: 1392 times
Last updated: 1/4/16, 6:57 AM