Community mailing list archives

Re: sql constraints not working

Vauxoo S.A. de C.V., Julio Serna
- 07/01/2016 11:29:18
Hello shabeer

If before to create sql_constraints you have in DB name duplicate the constraints it will not work, 
you must make sure that you do not have already duplicate name or you can use python constraint

2016-07-01 5:16 GMT-05:00 shabeer m <>:
hi community,
this sql constraints not working, please help me 

# Extending product.template
class apexion_product(models.Model):
"""docstring for apexion_product"""

_inherit = 'product.template'
md_approved = fields.Boolean(string="Is MD approved product")
brand_id = fields.Many2one('apexion.brand',string="Brand")

_sql_constraints = [
('name_unique', 'UNIQUE(name)', 'The name must be unique !'),

Post to:

Julio Serna