It is @luc-demeyer and @jbeficient that proposed this approach: in inner
WHERE clause on the start of the fiscal year makes sure that initial and
running balances are correct. This means that depending of the account
type, totals are computed from the start of the fiscal year or from the
beginning of time. This was initially suggested in
https://github.com/oca-sorrento/account-financial-reporting/pull/2
The WHERE clause on date_from and date_to is different and it is
outside because it affects which line are shown but not the initial and
running balance.