Thursday, January 22, 2026
1 change · 19.0
Resolved issues and error corrections
The accounting dashboard now calculates bank and cash journal balances directly from posted General Ledger entries, so users see the same balance in both places. This removes a major source of confusion where dashboard totals could differ by large amounts because some payments or manual entries were not included.
Original PR description
# Task ID: 16405 Fixed dashboard balance not matching General Ledger for bank/cash journals. --- ## Problem The Accounting Dashboard shows a different balance than the General Ledger for the same…
# Task ID: 16405
Fixed dashboard balance not matching General Ledger for bank/cash journals.
---
## Problem
The Accounting Dashboard shows a different balance than the General Ledger for the same account. For example, Cash Main showed $11,782,052.71 while the GL showed $10,107,036.89
(difference of ~$1.67M).
### Root Cause
The original formula used:
account_balance = journal.current_statement_balance + direct_payments_balance
This formula failed because:
| Issue | Impact |
|-------|--------|
| `direct_payments_balance` only counts payments with `origin_payment_id` link | 11,250 payments (~$72.6M) excluded |
| Miscellaneous entries (manual journals, payroll, adjustments) ignored | ~$76M not counted |
| Relies on bank statement data that may be incomplete | Statements with `first_line_index=NULL` excluded |
**Result**: Dashboard balance doesn't match the actual accounting balance.
### Affected Code
```python
# core/addons/account/models/account_journal_dashboard.py:540
dashboard_data[journal.id].update({
...
'account_balance': currency.format(journal.current_statement_balance + direct_payments_balance),
...
})
---
Solution
Replaced the formula with a direct GL balance query that always matches the General Ledger.
Also hidden the "Misc. Operations" line from the dashboard as it was causing confusion (these entries are now included in the main balance).
Files Modified
- addons/account/models/account_journal_dashboard.py
- Lines 535-539: Added GL balance calculation
- Line 540: Use gl_balance instead of formula
- Line 556: Set nb_misc_operations to 0 to hide the line
Code
Before:
dashboard_data[journal.id].update({
...
'account_balance': currency.format(journal.current_statement_balance + direct_payments_balance),
...
'nb_misc_operations': number_misc,
...
})
After:
gl_balance = sum(self.env['account.move.line'].search([
('account_id', '=', journal.default_account_id.id),
('parent_state', '=', 'posted'),
('company_id', 'in', self.env.companies.ids),
]).mapped('balance'))
dashboard_data[journal.id].update({
...
'account_balance': currency.format(gl_balance),
...
'nb_misc_operations': 0, # Hidden: misc operations not shown in dashboard
...
})
---
Steps to Reproduce (Before Fix)
1. Go to Accounting → Dashboard
2. Look at the balance of a Bank/Cash journal (e.g., Cash Main)
3. Click "Transactions" to open the General Ledger
4. Compare the balances
5. Observe they don't match
---
Expected Behavior (After Fix)
- Dashboard balance matches the General Ledger exactly
- "Misc. Operations" line no longer appears
- All posted entries are correctly included in the balance calculation