Kiran
Kiran

Reputation: 1531

How to redirect from one controller to another with params in odoo?

I have created a registration page for new user and company.I dont want to use default signup page which is already there because I have many custom fields. After creating new user and company I want to display user details in a new page. I am getting error as TypeError: 'dict' object is not callable. How to redirect from '/web/save' api to '/web/details' api with my parameter 'qcontext'.

@http.route('/web/save', type='http', method="post", auth="public",csrf=False)
def save_registration_details(self, **kw):
    qcontext = request.params.copy()
    # Code to create new user and company 

    return {
        'type': 'ir.actions.act_url',
        'url': '/web/details/%s' % qcontext,
        'target': 'self',
    }

@http.route('/web/details', type='http', auth="public")
def show_registration_details(self, qcontext, redirect=None, **kw):
    return http.request.render('odoo_web_login.success',qcontext)

Upvotes: 2

Views: 6277

Answers (2)

Vishal Khichadiya
Vishal Khichadiya

Reputation: 430

For redirect from One controller to another return url like this:

return {
        'type': 'ir.actions.act_url',
        'url': '/web/details?qcontext=%s&redirect=True' % (qcontext),
        'target': 'self',
    }

Upvotes: 0

You can try:

return werkzeug.utils.redirect('/web/details%s' % qcontext)

Upvotes: 3

Related Questions