Odoo Help

1

Select query for odoo

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

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

1
abderrahmen
On 2/23/15, 5:56 AM

using api8,

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

1
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):

EG:-

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

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

1
Temur
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?

Temur
on 2/26/15, 3:12 AM
1

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.

Register

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)

Stats

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