Indeed, putting the code in spawns the module even if the door is already open. I was pissed for a minute until I read this.
If your safe is already open and there's no O-AI module, hold Use on the front of the safe and put the code in as you normally would, and it should spawn.