Odoo Help


Select query for odoo

aneesh ATEES Infomedia Pvt Ltd
on 2/23/15, 5:25 AM 2,520 views

i need to select data from the database..how this possible?

On 2/23/15, 5:56 AM

using api8,

 self.env['tablename'].search_read([], []):

Baiju KS
On 2/23/15, 5:38 AM

Hi Aneesh,

You can use search function.

Search function takes a search domain, returns a recordset of matching records. Can return a subset of matching records (offset and limit parameters) and be ordered (order parameter):


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

search([('is_company', '=', True)], limit=1) give one record

On 2/23/15, 5:42 AM

If you're about direct queries to database, then cr.execute('select ....') is what you need, for details please refer to this page

BUT if it's not absolutelly necesary, you should prefer to use search() - browse() couple in Openerp 7.0 series and search() in Odoo 8.0.

plase give me one example?

aneesh ATEES Infomedia Pvt Ltd
on 2/26/15, 2:07 AM

You're asking for cr.execute() example or search() example?

on 2/26/15, 3:12 AM

can u please give me the full example with fucnction defnition

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

1 follower(s)


Asked: 2/23/15, 5:25 AM
Seen: 2520 times
Last updated: 3/16/15, 8:10 AM