I don't really like this solution as, if you wan't to do this for a lot of models, you'll have to work with a lot of if and elses, incrementing a lot the cyclomatic complexity, but it's the only way I've found to hide that button (you can also disable it with css).

You can do this by creating a button where you set invisible on the attributes. In these attributes you can use the 'state not in' in order to hide the button when it is not in a specific state (or the other way around, when it is). An example of both:

This is just an example, it will not work for you anyways. Do not expect other people to solve your problems and you just copy and paste. Read the tips here, search some more and solve your own damn problems. Thats the way to go. Cheers