From 186713ef9d3d56663a71c198e48a7dc52a504b95 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Mon, 10 Jan 2011 12:15:33 +0100 Subject: [PATCH] [FIX] account, aged balance report: removed fiscalyear filter and field from the query and wizard bzr revid: qdp-launchpad@tinyerp.com-20110110111533-xwo0j4nkm1de8392 --- addons/account/account_move_line.py | 6 +++++- addons/account/report/account_aged_partner_balance.py | 4 +++- .../wizard/account_report_aged_partner_balance_view.xml | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 60228a7ffe0..24ae867e68a 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -45,7 +45,11 @@ class account_move_line(osv.osv): if context.get('company_id', False): company_clause = " AND " +obj+".company_id = %s" % context.get('company_id', False) if not context.get('fiscalyear', False): - fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')]) + if context.get('all_fiscalyear', False): + #this option is needed by the aged balance report because otherwise, if we search only the draft ones, an open invoice of a closed fiscalyear won't be displayed + fiscalyear_ids = fiscalyear_obj.search(cr, uid, []) + else: + fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')]) else: #for initial balance as well as for normal query, we check only the selected FY because the best practice is to generate the FY opening entries fiscalyear_ids = [context['fiscalyear']] diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index 20c1fe7cc55..2812fd409e6 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -45,7 +45,9 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): def set_context(self, objects, data, ids, report_type=None): obj_move = self.pool.get('account.move.line') - self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {})) + ctx = data['form'].get('used_context', {}) + ctx.update({'fiscalyear': False, 'all_fiscalyear': True}) + self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx) self.direction_selection = data['form'].get('direction_selection', 'past') self.target_move = data['form'].get('target_move', 'all') self.date_from = data['form'].get('date_from', time.strftime('%Y-%m-%d')) diff --git a/addons/account/wizard/account_report_aged_partner_balance_view.xml b/addons/account/wizard/account_report_aged_partner_balance_view.xml index 195ccbef111..fb0952e4614 100644 --- a/addons/account/wizard/account_report_aged_partner_balance_view.xml +++ b/addons/account/wizard/account_report_aged_partner_balance_view.xml @@ -13,7 +13,6 @@