Tuesday, 26 November 2019

Webpage redirection using Odoo Controller

Webpage redirection using  Odoo Controller





from odoo import http
from odoo.http import request

class Custom(http.Controller):
    @http.route('/oldpage', auth='public', website=True)
    def newpage_redirect(self):
return request.redirect('newpage')

    @http.route('/newpage', auth='public', website=True)
    def newpage_render(self):
return http.request.render('appname.newpage', {})




Using the above code we can redirect the oldpage to newpage.



localhost:8069/oldpage        will redirect to    localhost:8069/newpage

No comments:

Post a Comment