跳至内容
菜单
此问题已终结
1 回复
3767 查看

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/ ?


形象
丢弃
最佳答案

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)



形象
丢弃
相关帖文 回复 查看 活动
4
10月 20
8880
3
2月 24
10335
1
11月 23
2771
1
6月 23
3525
0
2月 23
2656