Odoo Help


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.


[V8][psycopg2] Do I need to use my personal cursors?

on 6/16/15, 6:21 PM 377 views

I'm creating new definitions on my custom module and I have some doubts about the cursors I need to use.

Since I have developed my script on PyCharm I've created my set of cursor

con = psycopg2.connect(host='SERVERIP', database='DBNAME', user='odoo', password='XXXXX')
cur = con.cursor()

 where I use just

cur.fetchone(), cur.execute and con.commit()

As far I can see the file sql_db.py define the cursors that Odoo is using, starting with cr or cnx.

Since I would like to use my module with any db without insert new credentials I need to understand how Odoo is working.

Is technically correct to delete my connection and cursor declaration and use just the cr. already present on Odoo like

cr.fetchone(), cr.execute and cnx.commit()

or do I need to create a new layer?

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)


Asked: 6/16/15, 6:21 PM
Seen: 377 times
Last updated: 6/16/15, 6:27 PM