From cfac8a4d9dffdd6591b868464063b68e7ca4a1cb Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Mon, 18 Oct 2010 12:39:26 +0530 Subject: [PATCH] [FIX] account: Fix company analysis search view bzr revid: psi@tinyerp.co.in-20101018070926-8qebof4hg4nq8kfq --- addons/account/board_account_view.xml | 28 ++++++++--------- .../account/report/account_entries_report.py | 22 ++++++++------ .../report/account_entries_report_view.xml | 30 ++++++++++--------- 3 files changed, 43 insertions(+), 37 deletions(-) diff --git a/addons/account/board_account_view.xml b/addons/account/board_account_view.xml index ade29ef6f83..1cb1e3fab1f 100644 --- a/addons/account/board_account_view.xml +++ b/addons/account/board_account_view.xml @@ -20,22 +20,22 @@ graph,tree [('type','=','income')] - - Company Analysis - account.entries.report - form - tree,graph - {'group_by':['user_type'], 'group_by_no_leaf':1} - - - - Treasory - account.account - form - graph,tree + + Company Analysis + account.entries.report + form + tree,graph + {'group_by':['user_type'], 'group_by_no_leaf':1} + + + + Treasory + account.account + form + graph,tree [('type','=','liquidity')] - + board.account.form board.board diff --git a/addons/account/report/account_entries_report.py b/addons/account/report/account_entries_report.py index 942ca8c4fb8..80065880ad9 100644 --- a/addons/account/report/account_entries_report.py +++ b/addons/account/report/account_entries_report.py @@ -33,9 +33,9 @@ class account_entries_report(osv.osv): 'date_created': fields.date('Date Created', readonly=True), 'date_maturity': fields.date('Date Maturity', readonly=True), 'ref': fields.char('Reference', size=64, readonly=True), - 'nbr':fields.integer('# of Items', readonly=True), - 'debit':fields.float('Debit', readonly=True), - 'credit':fields.float('Credit', readonly=True), + 'nbr': fields.integer('# of Items', readonly=True), + 'debit': fields.float('Debit', readonly=True), + 'credit': fields.float('Credit', readonly=True), 'balance': fields.float('Balance', readonly=True), 'day': fields.char('Day', size=128, readonly=True), 'year': fields.char('Year', size=4, readonly=True), @@ -77,14 +77,16 @@ class account_entries_report(osv.osv): def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): + fiscalyear_obj = self.pool.get('account.fiscalyear') + period_obj = self.pool.get('account.period') for arg in args: if arg[0] == 'period_id' and arg[2] == 'current_period': - current_period = self.pool.get('account.period').find(cr, uid)[0] + current_period = period_obj.find(cr, uid)[0] args.append(['period_id','in',[current_period]]) break elif arg[0] == 'period_id' and arg[2] == 'current_year': - current_year = self.pool.get('account.fiscalyear').find(cr, uid) - ids = self.pool.get('account.fiscalyear').read(cr, uid, [current_year], ['period_ids'])[0]['period_ids'] + current_year = fiscalyear_obj.find(cr, uid) + ids = fiscalyear_obj.read(cr, uid, [current_year], ['period_ids'])[0]['period_ids'] args.append(['period_id','in',ids]) for a in [['period_id','in','current_year'], ['period_id','in','current_period']]: if a in args: @@ -94,15 +96,17 @@ class account_entries_report(osv.osv): def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): todel=[] + fiscalyear_obj = self.pool.get('account.fiscalyear') + period_obj = self.pool.get('account.period') for arg in domain: if arg[0] == 'period_id' and arg[2] == 'current_period': - current_period = self.pool.get('account.period').find(cr, uid)[0] + current_period = period_obj.find(cr, uid)[0] domain.append(['period_id','in',[current_period]]) todel.append(arg) break elif arg[0] == 'period_id' and arg[2] == 'current_year': - current_year = self.pool.get('account.fiscalyear').find(cr, uid) - ids = self.pool.get('account.fiscalyear').read(cr, uid, [current_year], ['period_ids'])[0]['period_ids'] + current_year = fiscalyear_obj.find(cr, uid) + ids = fiscalyear_obj.read(cr, uid, [current_year], ['period_ids'])[0]['period_ids'] domain.append(['period_id','in',ids]) todel.append(arg) for a in [['period_id','in','current_year'], ['period_id','in','current_period']]: diff --git a/addons/account/report/account_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml index fc75a05e029..cb316408885 100644 --- a/addons/account/report/account_entries_report_view.xml +++ b/addons/account/report/account_entries_report_view.xml @@ -88,20 +88,7 @@ - - - - - - - - - - - - - - + @@ -119,6 +106,19 @@ + + + + + + + + + + + + + @@ -127,6 +127,8 @@ account.entries.report form tree,graph + + {'group_by':[], 'search_default_usertype':1, 'search_default_thisyear':1, 'group_by_no_leaf':1} A tool search lets you know statistics on your different financial accounts that match your needs.