Odoo Help


This community 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.


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

on 3/2/15, 10:57 PM 800 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
--Atul Arvind--


I am odoo Enthusiast/Consultant from Baroda, Gujarat, India. Working with odoo from v5 to v9 and other opensource technology since 4+ years. Having Strong Expertise in

Requirement gathering & Gap Analysis

Odoo Development

Odoo Customization

Odoo Training

Odoo Integration

Server Administration

Odoo Migration


I am also active on StackOverflow.


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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


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