if he pees in his bed at 20 weeks, you are leaving him alone for too long and the longer it goes on, the harder it will be to train him out of it :(
We've had a couple of dogs, one taken on as an adult who took time to learn about glass doors, we stuck bits of fablon on the patio doors so that they could see there was something there which soon sorted that out. Once the dog has got the idea, then gradually take off the bits of fablon, the marks clean off with window cleaner.