Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
3776 Prikazi

Hi! My controller for my custom module is as follows:


class MyController(http.Controller):

@http.route('/odoo/', auth='public', type="http", website="True")

def index(self, **kw):

  return "Hello, world"


Let's say http://127.0.0.1/ already brings me to the homepage of my custom module, what I want is for this homepage to instead (or also) be loaded at http://127.0.0.1/odoo. How do I make it so that the adding the /odoo will bring me to the same page that is being loaded at http://127.0.0.1/ ?


Avatar
Opusti
Best Answer

You need to return the homepage template from your route.

@http.route('/odoo/', auth='public', type="http", website="True")
def index(self, **kw):
homepage = request.website.homepage_id
if homepage:
return request.env['ir.http'].reroute(homepage.url)



Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
4
okt. 20
8911
3
feb. 24
10357
1
nov. 23
2791
1
jun. 23
3554
0
feb. 23
2673