Using NewBoolVar in Google OR-Tools
In the official documentation it is documented how to do an If-Then-Else expression.
You aren't constraining b.Not()
:
model.Add(sum(working.assignment_vars_long[r,h,i] for h in range(0,144)) > 31).OnlyEnforceIf(b.Not())