From 01cbbd20219208dea5bbbd3ae8e8fd7d87a80b73 Mon Sep 17 00:00:00 2001 From: "nel@tinyerp.com" <> Date: Mon, 31 May 2010 12:49:43 +0200 Subject: [PATCH] [IMP] account: balance report bzr revid: nel@tinyerp.com-20100531104943-h5c7l9hreucue8ik --- addons/account/report/account_balance.py | 33 ++++++++---- addons/account/report/account_balance.rml | 63 +++++++++++++++++++++-- 2 files changed, 81 insertions(+), 15 deletions(-) diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index e4731e2c994..78683b5120b 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -22,9 +22,15 @@ import xml import copy from operator import itemgetter -import time import datetime from report import report_sxw +import xml.dom.minidom +import os, time +import osv +import re +import tools +import pooler +import sys class account_balance(report_sxw.rml_parse): _name = 'report.account.account.balance' @@ -44,6 +50,10 @@ class account_balance(report_sxw.rml_parse): }) self.context = context + def _add_header(self, node, header=1): + if header==0: + self.rml_header = "" + return True def get_fiscalyear(self, form): res=[] if form.has_key('fiscalyear'): @@ -56,16 +66,14 @@ class account_balance(report_sxw.rml_parse): def get_periods(self, form): result='' - if form.has_key('periods') and form['periods'][0][2]: - period_ids = form['periods'][0][2] - self.cr.execute("select name from account_period where id =ANY(%s)" ,(period_ids)) - res = self.cr.fetchall() - len_res = len(res) - for r in res: - if (r == res[len_res-1]): - result+=r[0]+". " + if form.has_key('periods') and form['periods']: + period_ids = form['periods'] + per_ids = self.pool.get('account.period').browse(self.cr,self.uid,form['periods']) + for r in per_ids: + if r == per_ids[len(per_ids)-1]: + result+=r.name+". " else: - result+=r[0]+", " + result+=r.name+", " else: fy_obj = self.pool.get('account.fiscalyear').browse(self.cr,self.uid,form['fiscalyear']) res = fy_obj.period_ids @@ -172,5 +180,8 @@ class account_balance(report_sxw.rml_parse): def _sum_debit(self): return self.sum_debit -report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=False) + + + +report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=0) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index fb8eb53c418..af4cee7a7ba 100644 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -66,6 +66,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -95,6 +116,8 @@ + + @@ -141,14 +164,46 @@ - + + - [[ get_fiscalyear(data['form']) or removeParentNode('para') ]]: - [[ get_periods(data['form']) or removeParentNode('para') ]] + Fiscal Year + + + End Date + + + Start Date + + + Display Account + + + Periods - + + + + + [[ get_fiscalyear(data['form']) ]] + + + [[ data['form']['date_from'] ]] + + + [[ data['form']['date_to'] ]] + + + [[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_mouvement' and 'With movements') or 'With balance is not equal to 0']] + + + [[data['form']['periods'] and get_periods(data['form']) or '']] + + + +