Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2117 Weergaven

The Passport and ID Number name must be unique for each country using api constrints, can you help me to solve this

Avatar
Annuleer
Auteur

@api.constrains('cpr','nationality')
def check_unique(self):
for record in self:
obj = self.search([('cpr','=',record.cpr),('id','!=',record.id)])
if obj:
raise ValidationError("The Passport and ID Number name must be unique for each country")