Don’t punish your dog if they pee inside. Regardless of all those old training ideas punishment isn’t a good deterrent for house training. Yelling at your dog after the fact just confuses them and makes them nervous around you. If you catch your did in the act you can try to get their attention & move them outdoors. If you’re successful & they continue going once you get outside praise them like crazy.
Suppose you consistently praise your puppy for their actions, while potty training. Then say your dog has an accident. Do not praise you dog immediately. Instead, take your dog outside and wait for it to go to the bathroom. When it finishes doing its business, take it inside, and keep it in a separate room while you clean up the mess. After this you should act disappointed in your dog, but only for a few minutes. Keep you and your dog motivated to potty train.
Many owners appear disappointed that their young puppy will not toilet when out on a walk, yet relieves itself the second it gets back home. This is because the puppy has been taught to toilet only at home (hopefully in its garden), and being creatures of habit, they often wait until they have returned home before evacuating their bladder and/ or bowels.