From 788404cd92144667fd4d4e4effcadac6237027a3 Mon Sep 17 00:00:00 2001 From: Pinakin Nayi Date: Thu, 19 Jun 2014 14:27:32 +0530 Subject: [PATCH] [FIX]Accounting: filter on fiscal year in CoA tree --- addons/account/account_move_line.py | 2 ++ addons/account/account_view.xml | 2 +- addons/account/wizard/account_chart.py | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 3d8d8302f32..2fa8451da99 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -741,6 +741,8 @@ class account_move_line(osv.osv): def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): if context is None: context = {} + if context.get('fiscalyear'): + args.append(('period_id.fiscalyear_id', '=', context.get('fiscalyear', False))) if context and context.get('next_partner_only', False): if not context.get('partner_id', False): partner = self.list_partners_to_reconcile(cr, uid, context=context) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 8afa19a63b0..1d340001c55 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -351,7 +351,7 @@ diff --git a/addons/account/wizard/account_chart.py b/addons/account/wizard/account_chart.py index 38df2f7484d..de652a947f0 100644 --- a/addons/account/wizard/account_chart.py +++ b/addons/account/wizard/account_chart.py @@ -62,9 +62,10 @@ class account_chart(osv.osv_memory): ORDER BY p.date_stop DESC LIMIT 1) AS period_stop''', (fiscalyear_id, fiscalyear_id)) periods = [i[0] for i in cr.fetchall()] - if periods and len(periods) > 1: + if periods: start_period = periods[0] - end_period = periods[1] + if len(periods) > 1: + end_period = periods[1] res['value'] = {'period_from': start_period, 'period_to': end_period} else: res['value'] = {'period_from': False, 'period_to': False}