Default Accounting Reports do not check initial balance settings
Flectra Version
Flectra 2.0
- installed from source code
- latest commit
Summary
- Account have a account type (user_type_id) and this type has also a internal type like "Liquidity".
- This internal type has a option: include_initial_balance (Bring Accounts Balance Forward)
This can be checked and found while configuring default financial reports:
- Accounting > Configuration > Financial Reports > Account Reports
By default on accounts with type "Bank and Cash" this flag in "Bank and Cash" > internal type > "Liquidity" > include_initial_balance is true!
If generating a "Balance Sheet" report, it should "Bring Accounts Balance Forward" if you set date from to 01.01.2023 and date end to 31.12.2023.
But if you define date from and to, ti will NOT "Bring Accounts Balance Forward" and will only output the balance between the defined date range.
Steps to reproduce
- create a new demo instance and install some apps like: account,account_accountant,sale_management,contacts,l10n_ch,crm,project,helpdesk_basic,purchase,stock,mass_mailing
- login as admin
- create two account moves
account move 1:
- reference: what ever you want
- date: 01.06.2022
- account debit: 1022
- amount debit: 1'000
- account credit: eg. 3600
- amount debit: 1'000
account move 2:
- reference: what ever you want
- date: 01.06.2023
- account debit: 1022
- amount debit: 1'000
- account credit: eg. 3600
- amount debit: 1'000
- Reporting > Balance Sheet
- let all default expect date from/to
- date from: 01.01.2022
- date to: 31.12.2022
- print it
result: so far so good
- Reporting > Balance Sheet
- let all default expect date from/to
- date from: 01.01.2023
- date to: 31.12.2023
- print it
result: wrong balance for account 1022, cause it should "Bring Accounts Balance Forward"
- Reporting > Balance Sheet
- let all default expect date from/to
- date from: leave empty
- date to: 31.12.2023
- print it
result: balance of 1022 looks correct, but it will have side effects if you have a lot of other moves
Last report will not check "include_initial_balance" it will just check if date from set and if not, the date domain is only [('date', '<=', context['date_to'])]
See code where it happends:
addons/account/models/account_move.py
- method _query_get
- line 5260
If you do the same with "Profit and Loss" report, and provide only date to, it will take all amounts from each year.
But "Profit and Loss" should only take amounts from current year.. so for "Profit and Loss" you must provide date from/to.
What is the current bug behavior?
It does not check "include_initial_balance" on internal types.
There is also a context.get('initial_bal') which is nowhere uses, so far i found...
What is the expected correct behavior?
Respect "include_initial_balance"... it must respect it, it's accounting basics.