This came up in a BEC Higher class. To keep it very simple it works like this:
We use ‘should’ instead of ‘shall’ and ‘would’ instead of ‘will’ in reported speech following the basic ‘one step back’ rule:
John: “I’ll take the dog for a walk” (direct speech)
becomes
John said (that) he would take the dog for a walk (reported speech)
and:
Jill “Shall I open the window?” (direct speech)
becomes
Jill asked if she should open the window (reported speech)
You can also replace ‘shall’ with ‘should’ in direct speech if you want to be super polite and/or express a greater degree of uncertainty, i.e. “Should I open the window?”