Current Priority

Soi agree more information would be good.
Do you plan to use a rechargable or non rechargable battery, cause this matters to the overall setup.

If not a rechargable and the power supply is higher than the battery voltage a simple silicone diode inline with the battery lead will stop the battery whenever the power supply is plugged in.

With a diode you have a 0.6volt drop across the diode, if the voltage on the output of the diode goes higher than the input - 0.6v then the diode acts like a cutoff valve and 'cuts off'

Daz