Odoo Help


Best way to access Model from outside the inherited osv class?

roman onosovski
on 6/16/14, 9:17 AM 1,601 views

I am writing an application to service Dropbox webhooks and I have a controller class:

class webhook(http.Controller):



   def index(self, req, **kwargs):

      """Need to access database tables here"""


So I figured out that I need a cr, uid, and some other parameters,

I defined the following and have gotten it to work:


cr = openerp.sql_db.db_connect("DBNAME").cursor()





Is this the best way to do this?

On 2/24/15, 8:37 AM

Hi !

As said in 


you can acces you models with:



Gustavo Seluja
On 9/22/15, 10:54 AM

Hi, I'm writing a controller for V7 and I have the same problem. I want to get the database name and the cursor but I can't because there is no a "request" parameter like in V8 to get the cr value and I can't obtain database name from anywhere. Is it possible to do it in anyway?

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: 6/16/14, 9:17 AM
Seen: 1601 times
Last updated: 9/22/15, 10:54 AM