Odoo Help


In database how to retrive fields from table

on 8/25/16, 7:25 AM 194 views

hai, i don't know how to retrive data from database

this is my python file

         @http.route('/sample/demo', auth='public',website=True)

         def click(self, **post):

            print "post data===================>",post

            cr = request.cr

            pool = request.registry


            user_id = post.get('user_id',False)

            response_dict = {}


            if user_id and table_name:


                        return http.request.render('json.arun1')


                print "Invalid user_id"

                return http.request.render('json.arunkumar')


    @http.route('/course/datas', auth='public',website=True)

    def index12(self, **post):

            print "post data===================>",post

            cr = request.cr


            # cr.execute("select coursename,coursefee from course_datas")

            cr.execute("select * from table_name")


            print "****************",res;


            if res:

                    jd = json.dumps(res)

                    print "Datas Json",jd

                    return jd

yousif Mobark
On 8/27/16, 8:19 AM

hello ,

try the browse(),search() method

browes method it receive the list of  ids  


search method receive list of tuples



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.


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: 8/25/16, 7:25 AM
Seen: 194 times
Last updated: 1/11/17, 9:48 PM