Community mailing list archives

community@mail.odoo.com

Re: sql constraints not working

by
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 <msg2shabeer@gmail.com>:
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 !'),
]

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Julio Serna
Vauxoo