Search code examples
odooodoo-8

Sql constraint on boolean field


Is there is a possibility to make SQL constraint for the boolean field? I want to make a constraint that will check all record and only 1 record can have boolean field checked


Solution

  • Try using this,

    _sql_constrainst =[('your const. id', 'check(your_bool_field != Null)', 'Your validation msg')]