Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
9637 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Tác giả

Anyone can suggest me on this?

Câu trả lời hay nhất
# -*- 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)
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 11 24
2832
0
thg 6 21
2418
1
thg 11 19
6098
1
thg 1 25
956
0
thg 3 23
933