Odoo Help


Where is the documentation for "SQL constraints"?

jonathan hartley
on 1/27/15, 9:54 AM 2,239 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?



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



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