From 47aae9553fa86da658168e95bbf9eabc49711d12 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 9 Dec 2010 17:39:18 +0530 Subject: [PATCH] [FIX] Account: account and account_financial_report - wrong selection condition on balance report lp bug: https://launchpad.net/bugs/582243 fixed bzr revid: mra@mra-laptop-20101209120918-zssimdszxldnx0v4 --- addons/account/report/account_balance.py | 5 +++-- addons/account/report/account_balance_sheet.py | 5 +++-- addons/account/report/account_profit_loss.py | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index f9697710f8f..45d7e107180 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -84,11 +84,12 @@ class account_balance(report_sxw.rml_parse, common_report_header): } self.sum_debit += account_rec['debit'] self.sum_credit += account_rec['credit'] + acc_digit = self.pool.get('decimal.precision').precision_get(self.cr, 1, 'Account') if disp_acc == 'bal_movement': - if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0: + if round(res['credit'], acc_digit) > 0 or round(res['debit'], acc_digit) > 0 or round(res['balance'], acc_digit) != 0: self.result_acc.append(res) elif disp_acc == 'bal_solde': - if res['balance'] != 0: + if round(res['balance'], acc_digit) != 0: self.result_acc.append(res) else: self.result_acc.append(res) diff --git a/addons/account/report/account_balance_sheet.py b/addons/account/report/account_balance_sheet.py index b6f39fbbebd..0c280d2edfd 100644 --- a/addons/account/report/account_balance_sheet.py +++ b/addons/account/report/account_balance_sheet.py @@ -129,15 +129,16 @@ class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header) 'level': account.level, 'balance':account.balance, } + acc_digit = self.pool.get('decimal.precision').precision_get(self.cr, 1, 'Account') if typ == 'liability' and account.type <> 'view' and (account.debit <> account.credit): self.result_sum_dr += account.balance if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit): self.result_sum_cr += account.balance if data['form']['display_account'] == 'bal_movement': - if account.credit > 0 or account.debit > 0 or account.balance > 0: + if round(account.credit, acc_digit) > 0 or round(account.debit, acc_digit) > 0 or round(account.balance, acc_digit) != 0: accounts_temp.append(account_dict) elif data['form']['display_account'] == 'bal_solde': - if account.balance != 0: + if round(account.balance, acc_digit) != 0: accounts_temp.append(account_dict) else: accounts_temp.append(account_dict) diff --git a/addons/account/report/account_profit_loss.py b/addons/account/report/account_profit_loss.py index 117f9e351fb..7c8248b8275 100644 --- a/addons/account/report/account_profit_loss.py +++ b/addons/account/report/account_profit_loss.py @@ -99,15 +99,16 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header): accounts_temp = [] for account in accounts: if (account.user_type.report_type) and (account.user_type.report_type == typ): + acc_digit = self.pool.get('decimal.precision').precision_get(self.cr, 1, 'Account') if typ == 'expense' and account.type <> 'view' and (account.debit <> account.credit): self.result_sum_dr += abs(account.debit - account.credit) if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit): self.result_sum_cr += abs(account.debit - account.credit) if data['form']['display_account'] == 'bal_movement': - if account.credit > 0 or account.debit > 0 or account.balance > 0: + if round(account.credit, acc_digit) > 0 or round(account.debit, acc_digit) > 0 or round(account.balance, acc_digit) != 0: accounts_temp.append(account) elif data['form']['display_account'] == 'bal_solde': - if account.balance != 0: + if round(account.balance, acc_digit) != 0: accounts_temp.append(account) else: accounts_temp.append(account)