From 9ecfe0c16c19c51ec7846e69e4ecf537ef8409e9 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Fri, 16 Jul 2010 16:37:48 +0530 Subject: [PATCH] [IMP] account: Improve the account report bzr revid: sbh@tinyerp.com-20100716110748-6z4o4vkk9p3vwfoi --- addons/account/report/common_report_header.py | 5 +++++ addons/account/report/general_journal.py | 3 ++- addons/account/report/general_journal.rml | 6 ++++-- addons/account/report/general_ledger.py | 5 +---- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/addons/account/report/common_report_header.py b/addons/account/report/common_report_header.py index 0b14b35c752..b8f3fb1c760 100644 --- a/addons/account/report/common_report_header.py +++ b/addons/account/report/common_report_header.py @@ -127,5 +127,10 @@ class common_report_header(object): if data.get('form', False) and data['form'].get('company_id', False): comp_obj = pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, data['form']['company_id']) return comp_obj.name + + def _get_journal(self, journal_ids): + self.cr.execute('select code from account_journal where id IN %s',(tuple(journal_ids),)) + codes = [x for x, in self.cr.fetchall()] + return codes or '' #vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/report/general_journal.py b/addons/account/report/general_journal.py index 8c0f7e47e40..d3c793e5fb4 100644 --- a/addons/account/report/general_journal.py +++ b/addons/account/report/general_journal.py @@ -49,7 +49,8 @@ class journal_print(report_sxw.rml_parse, common_report_header): '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_filter': self._get_filter, + 'get_journal': self._get_journal, }) def set_context(self, objects, data, ids, report_type=None): # Improve move to common default? diff --git a/addons/account/report/general_journal.rml b/addons/account/report/general_journal.rml index 5c2e625cbd1..04163556a8d 100644 --- a/addons/account/report/general_journal.rml +++ b/addons/account/report/general_journal.rml @@ -245,16 +245,18 @@ - + Chat Account Fiscal Year + Journals Filters By [[ get_filter(data)!='No Filter' and '' or removeParentNode('font') ]] Printing Date [[ get_account(data) or removeParentNode('para') ]] [[ get_fiscalyear(data) or removeParentNode('para') ]] + [[', '.join([ lt or '' for lt in get_journal(data['form']['journal_ids']) ]) ]] [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] @@ -319,7 +321,7 @@ [[ formatLang(sum_debit()) ]] [[ formatLang( sum_credit()) ]] [[ formatLang( sum_debit()- sum_credit()) ]] - [[ o.currency_id and formatLang(sum_currency_amount_account(o, data['form'])) +o.currency_id.code or '' ]] + [[ formatLang(sum_currency_amount_account(o, data['form'])) or '' ]] diff --git a/addons/account/report/general_ledger.py b/addons/account/report/general_ledger.py index 8b7a79c3cca..b232b5f7c59 100644 --- a/addons/account/report/general_ledger.py +++ b/addons/account/report/general_ledger.py @@ -227,10 +227,7 @@ class general_ledger(rml_parse.rml_parse, common_report_header): # Add initial balance to the result sum_currency += self.cr.fetchone()[0] or 0.0 return str(sum_currency) - def _get_journal(self, journal_ids): - self.cr.execute('select code from account_journal where id IN %s',(tuple(journal_ids),)) - codes = [x for x, in self.cr.fetchall()] - return codes or '' + report_sxw.report_sxw('report.account.general.ledger', 'account.account', 'addons/account/report/general_ledger.rml', parser=general_ledger, header='internal') report_sxw.report_sxw('report.account.general.ledger_landscape', 'account.account', 'addons/account/report/general_ledger_landscape.rml', parser=general_ledger, header='internal')