Odoo Help

1

Select query for odoo

By
aneesh ATEES Infomedia Pvt Ltd
on 2/23/15, 5:25 AM 1,826 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

--Baiju--
Baiju
3164
| 5 5 8
Kochi, India
--Baiju--
ODOO technical

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju
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

--Temur--
Temur
2896
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
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

aneesh ATEES Infomedia Pvt Ltd

--aneesh ATEES Infomedia Pvt Ltd--
aneesh ATEES Infomedia Pvt Ltd
http://www.atees.in
765
| 5 1 6
Thrissur, India
--aneesh ATEES Infomedia Pvt Ltd--

9995074692

aneesh ATEES Infomedia Pvt Ltd
On 2/26/15, 12:19 AM

can u please give me the full example with fucnction defnition

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 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: 1826 times
Last updated: 3/16/15, 8:10 AM