In Odoo 6 & 7 it was easier to remove the Sql constraints, but in Odoo 8.0 it is a little bit complex. For making it simpiler I will be showing how you can get this done.
There are basically two approaches for this,
First one is to fire a SQL command to remove the constraint directly from the database,
Second one is by creating a custom module, and removing the constraint.
The option you choose is completely dependent on your requirement.
First Approach : How to remove Constraint from the the Database directly:
1. Note down :
Table Name.
Constraint Name.
2. Structure for the the constraint name in the database is
“TableName”+”_”+”ConstraintName
e.g.,
Table Name : product_attribute_value
Constraint Name : value_company_uniq
Final : product_attribute_value_value_company_uniq
3. The SQL Command would be :
ALTER TABLE product_attribute_value DROP CONSTRAINT product_attribute_value_value_company_uniq;
In this approach there can be an issue, unless if that’s your need, and that is,
First, once you restart the server, those constraints will be applied again.
Second problem will be if you want to apply the constraint again, and you have entered any data which is violating this constraint, like this,
We use cookies to deliver personalized content, analyze trends, administer the site, track user movements on the site, and collect demographic information about our user base as a whole. Accept all cookies for the best possible experience on our website or manage your preferences.
What For?