跳至内容
菜单
此问题已终结
4912 查看

I am trying to override index method in website module in odoo 11.

Following is my code

from odoo import http
from addons.website.controllers.main import Website
class Home(Website):
@http.route(['/', '/index', '/home'], type='http', website=True, auth='public')
def index(self, **kw):
  super(Website, self).index(**kw)
  return http.request.render('my_website.home')

I have created a new template in my_website named home. But when I go to http://localhost:8069, it is loading the standard odoo template for website with header and footer. When I go to either http://localhost:8069/index or http://localhost:8069/home it is throwing 404 error. It doesn't take my new template home.

I have referred this SO question https://stackoverflow.com/questions/41195759/how-to-change-default-page-of-odoo-with-other-webcontroller-odoo-9-0 but doesn't work.

形象
丢弃
相关帖文 回复 查看 活动
2
2月 24
16321
1
12月 22
5551
2
12月 22
15255
2
6月 22
7318
2
6月 22
5393