At depletion region, a potential barrier is setup, E(electric field is from right to left)[according to viewer], but left side is shown to be at higher potential.
Inside a battery, E is in the direction of +ve terminal to -ve terminal.
1st image source: http://www.satishkashyap.com/2015/08/solutions-for-tutorial-2-on-pn-junction.html
2nd image source: http://web.mit.edu/sahughes/www/8.022/lec08.pdf