Odoo — Pass context from the controller to act_window

Rameshwor Dhakal
Bajra Technologies Blog
1 min readApr 6, 2019

--

It didn’t work when I tried to pass the context from the controller and get it in act_window.
The issue can be known clearly from here.

Then I tried a lot of tricks to get the context in act_window but none of the methods worked. Finally, I figured out a solution where I passed the data through a query string on the context.

First, a server action is defined as below:

This server action calls the open_profile_specific_appointments() method in model oe.appointment.

Then, a controller is defined which finds the id of above-defined server_action and returns a URL with an id of this action and query string containing ‘profile_id’.

The open_profile_specific_appointments() method in model oe.appointment includes the code that gets the query string from context.

The code above finds query string ‘profile_id’ from context and finally, it returns a new act_window to display the list of appointments by applying a filter on profile_id.

--

--

Software Engineer, a tech enthusiast, an open-source lover, and a good human being.