【发布时间】:2016-01-07 17:24:01
【问题描述】:
我在 odoo 8 中使用 web 控制器来创建一个 REST API,它将获取一些数据并从数据库返回值。问题是我无法从内置 ORM 中获取数据库。
我试图打电话给osv.pool.get(),但给了我错误:
AttributeError: type object 'Model' has no attribute 'pool'
Odoo 8 显然使用了记录集,但我也不能使用它,并且在文档上找不到任何有用的东西。
如何在 Web 控制器上浏览数据库数据?
我的代码:
class TestWebService(http.Controller):
@http.route('/test', type='http', auth='none')
def test(self):
objects = osv.osv.pool.get("some_table")
# I need to get the objects from some_table and search them
return "Hello World"
【问题讨论】:
标签: python python-2.7 openerp odoo-8 odoo-website