You can set <tree delete="0"> in view to disable deletion for all records. otherwise there is not way to put condition on that.
The way you tried overriding unlink() is only way to do it.
you can check your Boolean field value in method and raise Error Accordingly.
@api.multi
def unlink(self):
for rec in self:
if rec.your_boolean_field :
raise UserError(_('In order to delete a record, you must first unset your_boolean_field.'))
return super(YourModel, self).unlink()
You can set <tree delete="0"> in view to disable deletion for all records. otherwise there is not way to put condition on that.
hope this helps!