Comment 3 for bug 922621

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

You could do it with a simple CASE in the SQL query, but you need the value of the "account_account.currency_id" column, which may not be currently included in the query - so a bit of refactoring may be needed.
Something like:
    'foreign_balance': "CASE WHEN account_account.currency_id is NULL THEN 0 ELSE COALESCE(SUM(l.amount_currency), 0) END as foreign_balance"

It's not currently used in P&L, but only in the special "Unrealized Gain or Loss" report in Multi-Currency reports.
It could be added in P&L for information purpose, but only for accounts with secondary currencies.