The Passport and ID Number name must be unique for each country using api constrints, can you help me to solve this
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilitate
- Inventar
- PoS
- Project
- MRP
Această întrebare a fost marcată
2103
Vizualizări
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Înscrie-te
@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")