From 3a3342f59defbf72facce0fbeb3899d719a8469c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 23 Dec 2008 14:56:44 +0100 Subject: [PATCH] Add empty_account on trial balance for issue616 --- account.py | 14 ++++++++++++++ account.xml | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/account.py b/account.py index 90cd179e8b..a98433e406 100644 --- a/account.py +++ b/account.py @@ -1164,6 +1164,8 @@ class PrintTrialBalanceInit(WizardOSV): "('start_date', '>=', (start_period, 'start_date'))]") company = fields.Many2One('company.company', 'Company', required=True) posted = fields.Boolean('Posted Move', help='Only posted move') + empty_account = fields.Boolean('Empty Account', + help='With account without move') def default_fiscalyear(self, cursor, user, context=None): fiscalyear_obj = self.pool.get('account.fiscalyear') @@ -1188,6 +1190,9 @@ class PrintTrialBalanceInit(WizardOSV): def default_posted(self, cursor, user, context=None): return False + def default_empty_account(self, cursor, user, context=None): + return False + def on_change_fiscalyear(self, cursor, user, ids, vals, context=None): return { 'start_period': False, @@ -1275,6 +1280,15 @@ class TrialBalance(Report): accounts = account_obj.browse(cursor, user, account_ids, context=ctx) + if not datas['form']['empty_account']: + to_remove = [] + for account in accounts: + if account.debit == Decimal('0.0') \ + and account.credit == Decimal('0.0'): + to_remove.append(account) + for account in to_remove: + accounts.remove(account) + periods = period_obj.browse(cursor, user, end_period_ids, context=context) diff --git a/account.xml b/account.xml index 396adde477..b93305e8c5 100644 --- a/account.xml +++ b/account.xml @@ -681,7 +681,8 @@ this repository contains the full copyright notices and license terms. -->