İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
3806 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
4
Eki 20
8933
3
Şub 24
10402
1
Kas 23
2807
1
Haz 23
3572
0
Şub 23
2688