Odoo Help

Welcome!

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.

0

Data Retrieve from the Database

By
Dasadiya Chaitanya
on 1/22/14, 1:38 AM 2,503 views

How to Retrive the data from postgres sql and fill that data into text field in openerp ..? ? ? ?? ??

Can you explain your requirement in detail.

Gopakumar N G
on 1/22/14, 1:46 AM
1
shashank verma
On 1/22/14, 3:04 AM

Hi dasadiya

You can fetch records form postgresql table in 2ways 1. ORM methods 2. SQL queries

1.ORM method

prod_obj=self.pool.get(product.product) prod_name=prod_obj.browse(cr,uid,ids)[0].name

#this will return your product name

note=fields.text('Note')

note_create=prod_obj.write(cr,uid,[ids],{'note','=',prod_name})

#this will insert product name into your text field.

2.using sql queries

cr.execute("select * from product_product where id =%s",ids) result=result = map(lambda x: x[0], cr.fetchall())

thanks shashank verma...!!!

Dasadiya Chaitanya
on 1/23/14, 12:59 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

1 follower(s)

Stats

Asked: 1/22/14, 1:38 AM
Seen: 2503 times
Last updated: 11/14/16, 6:54 AM