From 9b3994db6baffacce935e5eefba9cb4eb305871e Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Thu, 2 Feb 2012 11:46:35 +0530 Subject: [PATCH] [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 --- addons/account/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account.py b/addons/account/account.py index b97fd870749..46e1d862526 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -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)