如何使用其他WebController odoo 9.0更改odoo的默认页面 [英] How to change default page of odoo with other webcontroller odoo 9.0

查看:366
本文介绍了如何使用其他WebController odoo 9.0更改odoo的默认页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个具有特定功能的新Webcontroller,并且希望将此Webcontroller用作odoo 9.0的主页.

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

我试图将@http.route('/', type='http', auth='public', website=True)放在我的自定义webcontroller文件的main.py中作为路由,但仍将其重定向到odoo的默认主页.

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.

但是,如果我将url设置为@http.route('/index', type='http', auth='public', website=True),则页面运行正常.

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

所以我的问题是用自定义控制器或模块替换现有odoo主页的最佳方法是什么.

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

推荐答案

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

这篇关于如何使用其他WebController odoo 9.0更改odoo的默认页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆