How can one open a particular object when pressing on a menu item or a button? It's useful if you want to have a sort a configuration-like object (only one object is needed to hold data e.g. username and password).
I've tried playing with view_init
method and active_id
context key, but with no luck. Can somebody point me to the right direction?
I had a similar issue, and found a solution :
in your ir.actions.act_window
definition (in XML), try to add the res_id
field with the id of your record you want to show. If this is id is calculated, perhaps you can use the "eval" attribute of the same field to get it.
For example :
<field name="res_id">5</field>
Or (i don't know if it works)
<field name="res_id" eval="your_func_getting_res_id"/>
Of course for 2nd method, don't forget to define your function.
It works for me when i wanted to return an ir.actions.act_window
in a method called by a button (method defined in python, so i got easily the id i wanted).
Hope it helps you or someone else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With