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

Where is the documentation for "SQL constraints"?

By
jonathan hartley
on 1/27/15, 9:54 AM 1,556 views

The OpenERP 6.1 developer book section on ORM fields documents the _sql_constraints field attribute by saying "See the SQL constraints section for further details". Where is this section? I cannot find it.

Thank you Jeremy for your answer. This example in the tutorial is good to see, but I'm still in the dark about things like:

Of the three-part tuple put into the _sql_constraints list: (name, condition, description), is the condition executed as part of a SQL command something like 'ALTER TABLE ADD CONSTRAINT {name} {condition}'? Knowing this would help us to know things like whether this is a good place to add indices to tables (presumably not.)

Is the generated SQL executed just on module creation, or can we add constraints to a module which is just being updated? If we modify the constraint in _sql_constraints, does the old constraint get dropped and the new one created when we update the module?

1

Jérémy Kersten (jke)

--Jérémy Kersten (jke)--
2993
| 3 2 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 1/27/15, 5:07 PM

Hello,

You can find documentation here : https://www.odoo.com/documentation/8.0/howtos/backend.html#model-constraints

Using PostgreSQL constraints doc : http://www.postgresql.org/docs/9.3/static/ddl-constraints.html

 

 

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/27/15, 9:54 AM
Seen: 1556 times
Last updated: 3/16/15, 8:10 AM