How to change default page of odoo with other webcontroller odoo 9.0

北城以北 提交于 2019-12-01 11:30:40

问题


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.


回答1:


# -*- 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)


来源:https://stackoverflow.com/questions/41195759/how-to-change-default-page-of-odoo-with-other-webcontroller-odoo-9-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!