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.


how to access database using python code?

willie ho
on 10/5/14, 9:24 PM 711 views

I want to access database and get the name from a table to check if the name exist or not.

I know that I need to override the create function but I have no idea for what should I put inside the function

Also, i'd like to ask how to pop up en error message like the validate checking when the name is existed



| 5 4 7
Bangalore, India

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

On 10/6/14, 3:33 AM

you can use cursor(or cr) present in a method..

almost all ORM methods will have these paramaters: self, cr, uid

so one can use cr, which is nothing but cursor paramater used to deal with database...

Example: cr.execute("select * from res_partner")

And to do validation: you can set _sql_constraints in your object

Hint: use Ctrl + H to search in you the addons, if you are using EDI like eclipse/aptana studio

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: 10/5/14, 9:24 PM
Seen: 711 times
Last updated: 3/16/15, 8:10 AM