Odoo helps you to set validations to recordsets with the help of python and model constraints. Mainly there are two ways in which constraints can be set to variants in Odoo. They are python and sql constraints.
Basically python constraints are set in odoo using the class decorator api.constrains() which takes in the field name as arguments and applies the validation conditions to the fields specified inside the method.