You should only be able to change ship commanders when they are in port over a friendly world. I hate it when I send out a hand-picked commander only for him to be promoted in transit and be magically replaced with someone else. Promotion and assignment checks should only occur to unassigned and orbiting officers.
Be really cool if the XO or, failing that, highest rated officer on a ship could take over if the commander is killed.