Skip to content

Commit

Permalink
[FIX] account: hide misc amount in case of different currencies
Browse files Browse the repository at this point in the history
Steps:
------
1. Have accounting installed.
2. Have a bank journal with a currency different from company's currency,
use a bank account with no currency set for this bank journal.
3. Make a misc operation in the bank account used by the journal.
4. On the dashboard, the "Misc. Operations" amount will not be converted
to the journal's currency, even though the currency's symbol is correct,
the amount is in the company's currency.

Fix
---
Do not show the total amount of misc operations if the bank journal and
bank journal's bank account currencies are not matching. The user still
knows there are journal entries not linked to a bank transaction thanks
to the "misc operations" text, but we avoid doing a currency conversion
that may not make sense.

opw-3767010

closes #163498

X-original-commit: 629f292
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
  • Loading branch information
taqu-odoo committed Apr 26, 2024
1 parent 9c93eb3 commit f2f2737
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addons/account/models/account_journal_dashboard.py
Expand Up @@ -447,6 +447,7 @@ def _fill_bank_cash_dashboard_data(self, dashboard_data):
has_outstanding, outstanding_pay_account_balance = outstanding_pay_account_balances[journal.id]
to_check_balance, number_to_check = to_check.get(journal, (0, 0))
misc_balance, number_misc = misc_totals.get(journal.default_account_id, (0, 0))
currency_consistent = not journal.currency_id or journal.currency_id == journal.default_account_id.currency_id
accessible = journal.company_id.id in journal.company_id._accessible_branches().ids

dashboard_data[journal.id].update({
Expand All @@ -463,7 +464,7 @@ def _fill_bank_cash_dashboard_data(self, dashboard_data):
'bank_statements_source': journal.bank_statements_source,
'is_sample_data': journal.has_statement_lines,
'nb_misc_operations': number_misc,
'misc_operations_balance': currency.format(misc_balance),
'misc_operations_balance': currency.format(misc_balance) if currency_consistent else None,
})

def _fill_sale_purchase_dashboard_data(self, dashboard_data):
Expand Down

0 comments on commit f2f2737

Please sign in to comment.