Skip to content
  • Categories
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse

Odoo 中文社区

  1. Home
  2. Categories
  3. Odoo 新手求助
  4. 如何实现不登录ODOO,访问里面的模块。

如何实现不登录ODOO,访问里面的模块。

Scheduled Pinned Locked Moved Odoo 新手求助
3 Posts 3 Posters 2.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    deathmen
    wrote on last edited by
    #1

    想使用ODOO做一个网站 ,如果不登录可以访问里面的内容不。安装这个例子写了一个控制器。
    class Mymodule(http.Controller):@http.route('/mymodule/mymodule/', auth='public')def index(self, **kw):return "Hello, world"

    在不能登录ODOO的时候 ,访问localhost:8069/mymodule/mymodule/ 页面会报错。登录odoo后再输入网址就返回Hello, world

    1 Reply Last reply
    0
    • D Offline
      D Offline
      digitalsatori
      管理员
      wrote on last edited by
      #2

      请编辑你的帖子将代码部分包括在```中,这样你的代码就能保持格式并有语法高亮了。

      你可以试试在你的的视图方法index的route装饰器中添加website=True参数,即:
      @http.route('mymodule/mymodule/', auth='public', website=True)

      【上海先安科技】(tony AT openerp.cn)

      1 Reply Last reply
      0
      • JoshuaJ Offline
        JoshuaJ Offline
        Joshua
        管理员
        wrote on last edited by Joshua
        #3

        怀疑你的问题是因为你的odoo server有多个数据库,在没有选定数据库的时候,某个数据库的路由是不起作用的,这也解释为什么登录了之后就能访问这个路由,因为你的登录的过程就是选定数据库的过程。所以我建议你启动odoo的时候加上命令--db-filter=数据库名来过滤掉其他数据库

        【上海先安科技】(joshua AT openerp.cn),欢迎关注公众号:openerp_cn

        1 Reply Last reply
        1

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Tags
        • Popular
        • Users
        • Groups