Tales Pádua
Tales Pádua

Reputation: 1461

Odoo - How to acess recordsets on web controller

I am using web controller in odoo 8 to make a REST API that will get some data and return values from the database. The problem is that I am not able to get the database from the builtin ORM.
I tried to call osv.pool.get() but gave me the error:

AttributeError: type object 'Model' has no attribute 'pool'

Odoo 8 apparently uses recordsets, but I can't use it too, and couldn't find anything usefull on docs.

How can I browse database data on web controller?

My code:

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"

Upvotes: 1

Views: 651

Answers (1)

Hardik Patadia
Hardik Patadia

Reputation: 1999

Try Following

myobj = request.env['some.table']

Upvotes: 2

Related Questions