[FIX] account : foreign_balance should not be computed for account with no secondary currency

lp bug: https://launchpad.net/bugs/922621 fixed

bzr revid: mdi@tinyerp.com-20120202061635-1f6ax1ce6vu6zbbw
This commit is contained in:
Divyesh Makwana (Open ERP) 2012-02-02 11:46:35 +05:30
parent 1928854809
commit 9b3994db6b
1 changed files with 1 additions and 1 deletions

View File

@ -278,7 +278,7 @@ class account_account(osv.osv):
"- COALESCE(SUM(l.credit), 0) as balance",
'debit': "COALESCE(SUM(l.debit), 0) as debit",
'credit': "COALESCE(SUM(l.credit), 0) as credit",
'foreign_balance': "COALESCE(SUM(l.amount_currency), 0) as foreign_balance",
'foreign_balance': "(SELECT CASE WHEN currency_id IS NULL THEN 0 ELSE COALESCE(SUM(l.amount_currency), 0) END FROM account_account WHERE id IN (l.account_id)) as foreign_balance ",
}
#get all the necessary accounts
children_and_consolidated = self._get_children_and_consol(cr, uid, ids, context=context)