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_windowdefinition (in XML), try to add theres_idfield 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 :
Or (i don’t know if it works)
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_windowin 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.