Odoo Help


How to 'get' and 'search' under V8?

on 3/2/15, 10:57 PM 1,379 views


I am a bit lost. I am trying to translate my module to V8, but can't find the way to translate the following statement:

self.pool.get('some_model').search(cr, uid, [('cols', '=', hotel)], context=context)

I found out that the search works like this:

self.search([('is_company', '=', True), ('customer', '=', True)])

but can't find how to get the external model first (self.pool.get).

Any tip on where to look will be appreciated! Thanks!



Atul Arvind

--Atul Arvind--
| 3 3 5
vadodara, India
--Atul Arvind--


I am odoo Enthusiast/Developer from Vadodara, India. Working with odoo from v5 to v11 and other opensource technology since 5+ years. Having Strong Expertise in

Odoo Development

Odoo Customization

Odoo Training

Odoo Integration

Server Administration

Odoo Migration


Here is my StackOverflow profile.  you can also find me on LinkedIn.

Contact: atul.surficle@gmail.com.

Atul Arvind
On 3/3/15, 1:36 AM

In new api you can search your domain directly like

self.search([(’is_company’, ’=’, True)])

will return record set

    >> model.model(1,2,3,4)

It will return direct record set.

In the new API the notion of Environment is introduced. Its main objective is to provide an encapsulation around
cursor, user_id, model, and context, Recordset and caches.

If you wanted to search another object's record

user_env = self.env[’res.users’]
user_env.search([(’login’, ’=’, ’atul’)])

will return record set


Thanks Atui! the self.env part was the one I was missing. Thank you

on 3/3/15, 7:39 AM



| 5 3 8
Pondicherry, India
On 3/2/15, 11:39 PM

Hi yakito,

you can search anything from external model by using this code:

self.env['res.partner'].search([['is_company', '=', True], ['customer', '=', True]])


Try this..

Thanks a lot Vasanth!

on 3/3/15, 7:38 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 3/2/15, 10:57 PM
Seen: 1379 times
Last updated: 4/6/15, 6:11 AM