constrains装饰用于对字段进行限制应用举例:定义列:age = fields.Integer(string="age") 方法:@api.constrains('age') def _check_age(self): if self.age<16: raise ValueError(_('Age must be older than 16'))