The time it takes for rats body to decompose can vary but most times a rats body should start to decompose within 1 to 4 days after it dies and then it can take from 1 week to a full 3 weeks for the Rats body to fully decompose and no longer smell.
If you have a dead rat in a wall you may want to open the wall where the rat is and remove it and replace the drywall or other wall material but that can be costly especially if you have someone do it for you.
Although the smell can be bad it's best to just wait it out and let the body decompose over a period of 2 to 3 weeks and then the smell should be gone.