[FIX] account: hide misc amount in case of different currencies
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 odoo/odoo#156655 Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
This commit is contained in:
@@ -423,6 +423,7 @@ class account_journal(models.Model):
|
||||
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({
|
||||
@@ -439,7 +440,7 @@ class account_journal(models.Model):
|
||||
'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):
|
||||
|
||||
Reference in New Issue
Block a user