Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
3833 Ansichten

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
Verwerfen
Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
4
Okt. 20
9059
3
Feb. 24
10480
1
Nov. 23
2910
1
Juni 23
3659
0
Feb. 23
2743