Hai Pawan Sharma,
_sql_constraints = [ ('name_uniq', 'UNIQUE (name)', 'You can not have two users with the same name !') ]
'name_uniq' is constraint name give any name.(no need to define)
Example _constraints:-
def _check_name(self, cr, uid, ids, context=None):
for val in self.read(cr, uid, ids, ['name'], context=context):
if val['name']:
if len(val['name']) < 6:
return False
return True
_constraints = [ (_check_name, 'Name must have at least 6 characters.', ['name']) ]
Note: Based on the above example in the records name field any duplicate record or name field less than 6 character then remove the records and add the constraints in python restart the server, update the module then only it works.