Odoo 8.0 new API 之constrains装饰

时间:2014-08-06 18:27:01   收藏:0   阅读:351

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))

 

Odoo 8.0 new API 之constrains装饰,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!