From 147caf88f158db2fabadf5995c08ad1eae44740d Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 22 Jul 2010 11:06:54 +0530 Subject: [PATCH] [IMP]: add the function in report and improve the report bzr revid: sbh@tinyerp.com-20100722053654-1aq4m8bm7osg3ban --- addons/account/report/partner_balance.py | 2 + .../account/report/report_balance_sheet.rml | 82 ++++++++++++++++--- addons/account/report/report_bs.py | 23 ++++++ 3 files changed, 96 insertions(+), 11 deletions(-) diff --git a/addons/account/report/partner_balance.py b/addons/account/report/partner_balance.py index 544b84fcf90..e70069f962c 100644 --- a/addons/account/report/partner_balance.py +++ b/addons/account/report/partner_balance.py @@ -52,6 +52,8 @@ class partner_balance(report_sxw.rml_parse, common_report_header): 'get_account': self._get_account, 'get_start_date':self._get_start_date, 'get_end_date':self._get_end_date, + 'get_start_period': self.get_start_period, + 'get_end_period': self.get_end_period, }) ## Compute account list one time # diff --git a/addons/account/report/report_balance_sheet.rml b/addons/account/report/report_balance_sheet.rml index 6f8f6aa39b1..70c878df2cb 100644 --- a/addons/account/report/report_balance_sheet.rml +++ b/addons/account/report/report_balance_sheet.rml @@ -77,6 +77,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -143,7 +176,7 @@ - [[ get_company(data['form']) ]] + [[ get_company(data) ]] @@ -154,18 +187,45 @@ - + - - From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]] - + Chart of Account + Fiscal Year + Journals + Filters By [[ get_filter(data)!='No Filter' and '' or removeParentNode('font') ]] + Display Account + Printing Date - - - [[ get_data(data['form']) ]] - - - + + [[ get_account(data) or removeParentNode('para') ]] + [[ get_fiscalyear(data) or removeParentNode('para') ]] + [[', '.join([ lt or '' for lt in get_journal(data) ]) ]] + [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] + [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + + Start Date + End Date + + + [[ get_start_date(data)]] + [[get_end_date(data) ]] + + + [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + + Start Period + End Period + + + [[ get_start_period(data) or removeParentNode('para') ]] + [[ get_end_period(data) or removeParentNode('para') ]] + + + + [[ (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']] + [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] + + diff --git a/addons/account/report/report_bs.py b/addons/account/report/report_bs.py index 271f1e5c214..347c40c67f1 100644 --- a/addons/account/report/report_bs.py +++ b/addons/account/report/report_bs.py @@ -46,10 +46,33 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header): 'sum_cr' : self.sum_cr, 'get_data':self.get_data, 'get_pl_balance':self.get_pl_balance, + 'get_fiscalyear': self._get_fiscalyear, + 'get_account': self._get_account, + 'get_start_period': self.get_start_period, + 'get_end_period': self.get_end_period, + 'get_sortby': self._get_sortby, + 'sum_currency_amount_account': self._sum_currency_amount_account, + 'get_filter': self._get_filter, + 'get_journal': self._get_journal, + 'get_start_date':self._get_start_date, + 'get_end_date':self._get_end_date, + 'get_company':self._get_company, }) self.context = context + + def _sum_currency_amount_account(self, account, form): + self._set_get_account_currency_code(account.id) + self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,)) + total = self.cr.fetchone() + + if self.account_currency: + return_field = str(total[0]) + self.account_currency + return return_field + else: + currency_total = self.tot_currency = 0.0 + return currency_total def sum_dr(self): if self.res_pl['type'] == 'Net Profit': self.result_sum_dr += self.res_pl['balance']