跳至內容
選單
此問題已被標幟
2 回覆
9667 瀏覽次數

I have created a new webcontroller with specific functionality and I want this webcontroller as a home page of odoo 9.0.

I have tried to put @http.route('/', type='http', auth='public', website=True) in main.py of my custom webcontroller file as a route, but still it redirect to default home page of odoo. 

But if I put url as @http.route('/index', type='http', auth='public', website=True), the page is working fine.

So my question is what is best way to replace existing odoo home page with custom controller or module.

Any help really appreciated.

頭像
捨棄
作者

Anyone can suggest me on this?

最佳答案
# -*- coding: utf-8 -*-
from openerp import http
from openerp.addons.website.controllers.main import Website

class Website(Website):
    @http.route(auth='public')
    def index(self, data={},**kw):
        super(Website, self).index(**kw)
        return http.request.render('<your_addon>.<your_template_id>', data)
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
11月 24
2839
0
6月 21
2431
1
11月 19
6125
1
1月 25
981
0
3月 23
933