Hi from my understanding is that when the battery is not connected to anything it has two "places" in it: one has more positive charge located near the positive terminal and another one has negative charge located near the negative terminal. An amount of work has already been done once to separate the charges.
When it's connected to a circuit, charges flow from the positive terminal back to the negative terminal. When the charge is at the negative terminal, the battery does work to move the charge to the positive terminal because it wants to maintain the original charge distribution on the two "places". In doing so, it gives e.m.f. to unit charge. Charge also loses a portion of that energy to the internal resistance.
But what happens when the current goes from the positive terminal directly to the negative terminal as in the case when two batteries are connected in series, and one battery has a larger e.m.f than the other and the positive terminals face each other?
From Kirchhoff's law charge will go from the positive terminal of the stronger battery to the positive terminal of the weaker battery and then to the next terminal of the weaker battery and back to the positive terminal of the stronger battery. It loses energy to the weaker battery that is e.m.f per unit charge. It also loses energy to the internal resistance of the weaker battery.
I think, what happens inside the stronger battery remains the same. But what is happening in the weaker battery? I have so much confusion about that.