From 11989f6cd2b4b919d0f95e49ffc9076462ec471e Mon Sep 17 00:00:00 2001 From: "Jagdish Panchal (Open ERP)" Date: Fri, 10 Feb 2012 18:57:42 +0530 Subject: [PATCH] [IMP] Add the Debit and Credit fields in financial report bzr revid: jap@tinyerp.com-20120210132742-wkqwvfjgoo7gzqtm --- .../report/account_financial_report.py | 5 +++ .../report/account_financial_report.rml | 42 +++++++++++++++++++ .../wizard/account_financial_report.py | 3 +- .../wizard/account_financial_report_view.xml | 1 + 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/addons/account/report/account_financial_report.py b/addons/account/report/account_financial_report.py index eed42230aaf..148c7209baa 100644 --- a/addons/account/report/account_financial_report.py +++ b/addons/account/report/account_financial_report.py @@ -86,7 +86,12 @@ class report_account_common(report_sxw.rml_parse, common_report_header): 'type': 'account', 'level': report.display_detail == 'detail_with_hierarchy' and min(account.level + 1,6) or 6, #account.level + 1 'account_type': account.type, + } + if data['form']['debit_credit'] == True: + vals['debit'] = account.debit + vals['credit'] = account.credit + lines.append(vals) if not currency_obj.is_zero(self.cr, self.uid, account.company_id.currency_id, vals['balance']): flag = True if data['form']['enable_filter']: diff --git a/addons/account/report/account_financial_report.rml b/addons/account/report/account_financial_report.rml index be2e349bd0c..63377a27655 100644 --- a/addons/account/report/account_financial_report.rml +++ b/addons/account/report/account_financial_report.rml @@ -207,10 +207,12 @@ [[ data['form']['enable_filter'] == 0 or removeParentNode('blockTable') ]] + [[ data['form']['debit_credit'] == 0 or removeParentNode('blockTable') ]] Name + Balance @@ -220,12 +222,52 @@ [[ (a.get('level') <> 0) or removeParentNode('tr') ]] [[ setTag('tr','tr',{'style': 'Table'+str(min(3,'level' in a and a.get('level') or 1))}) ]] [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_name'}) ]][[ a.get('name') ]] + [[ (a.get('account_type') =='view' and a.get('level') <> 1) or removeParentNode('td') ]] [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] [[ (a.get('account_type') <>'view' or a.get('level') == 1) or removeParentNode('td') ]] [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] + + + + [[ data['form']['debit_credit'] == 1 or removeParentNode('blockTable') ]] + + + Name + + + + Debit + + + Credit + + + + Balance + + + + [[ repeatIn(get_lines(data), 'a') ]] + [[ (a.get('level') <> 0) or removeParentNode('tr') ]] + [[ setTag('tr','tr',{'style': 'Table'+str(min(3,'level' in a and a.get('level') or 1))}) ]] + [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_name'}) ]][[ a.get('name') ]] + + [[ a.get('debit') or '0.00']] + + [[ a.get('credit') or '0.00' ]] + + [[ (a.get('account_type') =='view' and a.get('level') <> 1) or removeParentNode('td') ]] + [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] + [[ (a.get('account_type') <>'view' or a.get('level') == 1) or removeParentNode('td') ]] + [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] + + + + + diff --git a/addons/account/wizard/account_financial_report.py b/addons/account/wizard/account_financial_report.py index e0a55374f29..f9582759ee0 100644 --- a/addons/account/wizard/account_financial_report.py +++ b/addons/account/wizard/account_financial_report.py @@ -36,6 +36,7 @@ class accounting_report(osv.osv_memory): 'period_to_cmp': fields.many2one('account.period', 'End Period'), 'date_from_cmp': fields.date("Start Date"), 'date_to_cmp': fields.date("End Date"), + 'debit_credit': fields.boolean('Debit/Credit'), } def _get_account_report(self, cr, uid, context=None): @@ -85,7 +86,7 @@ class accounting_report(osv.osv_memory): return res def _print_report(self, cr, uid, ids, data, context=None): - data['form'].update(self.read(cr, uid, ids, ['date_from_cmp', 'date_to_cmp', 'fiscalyear_id_cmp', 'period_from_cmp', 'period_to_cmp', 'filter_cmp', 'account_report_id', 'enable_filter', 'label_filter'], context=context)[0]) + data['form'].update(self.read(cr, uid, ids, ['date_from_cmp', 'debit_credit', 'date_to_cmp', 'fiscalyear_id_cmp', 'period_from_cmp', 'period_to_cmp', 'filter_cmp', 'account_report_id', 'enable_filter', 'label_filter'], context=context)[0]) return { 'type': 'ir.actions.report.xml', 'report_name': 'account.financial.report', diff --git a/addons/account/wizard/account_financial_report_view.xml b/addons/account/wizard/account_financial_report_view.xml index 07f3e109ef8..dc962a5efb7 100644 --- a/addons/account/wizard/account_financial_report_view.xml +++ b/addons/account/wizard/account_financial_report_view.xml @@ -11,6 +11,7 @@ +