Fixes #4440: correct the logic that links machine, node, and inventory status

This a rather big pull request for a bug, but I didn't found a cleaner and smaller way to correct all the mess that was here. 

So now, the main logic is:

- a machine is identified by its ID, not its status. That means that in the case of the same machine with several status (what does not have any meaning), we always use the order Accepted > Pending > Remove
- the node's container DN is the truth for the node <-> machine link. If the link is false, we don't get back the machine with the node when requesting a node (but at least, we preciselly know what we were looking for). 
- when moving a machine or a node,  we are smart: we check for other nodes with that machine, look for the priority, and then only put the machine in the same status than the node of most priority, and above everything, we update all reference to that machine in node container.
- oh, and I added tests that cover all these intentions (what lead to #4464...)

With that, I hope to put a end to all the never ending stream of bugs around machine inventory (bad search, inventory not updating, missing information in webapp screens, etc)