From 1aff898d807e7311c507668e4a604997b7c225b5 Mon Sep 17 00:00:00 2001 From: Yanina Aular Date: Thu, 20 Jun 2013 14:15:35 -0530 Subject: [PATCH] [IMP] calculation with level --- account_financial_report/report/parser.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/account_financial_report/report/parser.py b/account_financial_report/report/parser.py index b904d6d0..fdf75d73 100644 --- a/account_financial_report/report/parser.py +++ b/account_financial_report/report/parser.py @@ -348,9 +348,12 @@ class account_balance(report_sxw.rml_parse): ################################################################ # Get the accounts # ################################################################ + all_account_ids = _get_children_and_consol(self.cr, self.uid, account_ids, 100, self.context) + account_ids = _get_children_and_consol(self.cr, self.uid, account_ids, form[ 'display_account_level'] and form['display_account_level'] or 100, self.context) + credit_account_ids = _get_children_and_consol( self.cr, self.uid, credit_account_ids, 100, self.context, change_sign=True) @@ -411,12 +414,12 @@ class account_balance(report_sxw.rml_parse): ############################################################### account_black_ids = account_obj.search(self.cr, self.uid, ( - [('id', 'in', [i[0] for i in account_ids]), + [('id', 'in', [i[0] for i in all_account_ids]), ('type', 'not in', ('view', 'consolidation'))])) account_not_black_ids = account_obj.search(self.cr, self.uid, ([('id', 'in', [ - i[0] for i in account_ids]), ('type', 'in', ('view', 'consolidation'))])) + i[0] for i in all_account_ids]), ('type', 'in', ('view', 'consolidation'))])) #This could be done quickly with a sql sentence account_not_black = account_obj.browse( @@ -490,6 +493,7 @@ class account_balance(report_sxw.rml_parse): for acc_id in account_not_black_ids: acc_childs = dict_not_black.get(acc_id).get('obj').child_id for child_id in acc_childs: + #pdb.set_trace() dict_not_black.get(acc_id)['debit'] += all_account.get( child_id.id).get('debit') dict_not_black.get(acc_id)['credit'] += all_account.get( @@ -735,6 +739,12 @@ class account_balance(report_sxw.rml_parse): 'total': True, } if form['columns'] == 'qtr': + for i in range(1, 6): + bal = 'bal%s' % i + res2[bal] = eval("tot_bal%s", self.context, mode='exec', nocopy=True) + #pdb.set_trace() + #eval("tot_bal%s += res.get('bal%s', 0.0)" % (i,i), self.context, mode='exec', nocopy=True) + res2.update(dict( bal1=tot_bal1, bal2=tot_bal2,