diff --git a/addons/account/account_financial_report.py b/addons/account/account_financial_report.py index 4ee8ac3d74b..0688d6f12b1 100644 --- a/addons/account/account_financial_report.py +++ b/addons/account/account_financial_report.py @@ -104,20 +104,30 @@ class account_financial_report(osv.osv): ('account_report','Report Value'), ],'Type'), 'account_ids': fields.many2many('account.account', 'account_account_financial_report', 'report_line_id', 'account_id', 'Accounts'), + 'account_report_id': fields.many2one('account.financial.report', 'Report Value'), + 'account_type_ids': fields.many2many('account.account.type', 'account_account_financial_report_type', 'report_id', 'account_type_id', 'Account Types'), + 'sign': fields.selection([(-1, 'Reverse balance sign'), (1, 'Preserve balance sign')], 'Sign on Reports', required=True, help='For accounts that are typically more debited than credited and that you would like to print as negative amounts in your reports, you should reverse the sign of the balance; e.g.: Expense account. The same applies for accounts that are typically more credited than debited and that you would like to print as positive amounts in your reports; e.g.: Income account.'), 'display_detail': fields.selection([ ('no_detail','No detail'), ('detail_flat','Display children flat'), ('detail_with_hierarchy','Display children with hierarchy') ], 'Display details'), - 'account_report_id': fields.many2one('account.financial.report', 'Report Value'), - 'account_type_ids': fields.many2many('account.account.type', 'account_account_financial_report_type', 'report_id', 'account_type_id', 'Account Types'), - 'sign': fields.selection([(-1, 'Reverse balance sign'), (1, 'Preserve balance sign')], 'Sign on Reports', required=True, help='For accounts that are typically more debited than credited and that you would like to print as negative amounts in your reports, you should reverse the sign of the balance; e.g.: Expense account. The same applies for accounts that are typically more credited than debited and that you would like to print as positive amounts in your reports; e.g.: Income account.'), + 'style_overwrite': fields.selection([ + (0, 'Automatic formatting'), + (1,'Main Title 1 (bold, underlined)'), + (2,'Title 2 (bold)'), + (3,'Title 3 (bold, smaller)'), + (4,'Normal Text'), + (5,'Italic Text (smaller)'), + (6,'Smallest Text'), + ],'Financial Report Style', help="You can set up here the format you want this record to be displayed. If you leave the automatic formatting, it will be computed based on the financial reports hierarchy (auto-computed field 'level')."), } _defaults = { 'type': 'sum', 'display_detail': 'detail_flat', 'sign': 1, + 'style_overwrite': 0, } account_financial_report() diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 3a28ea9a244..e7686919d22 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2786,6 +2786,7 @@ action = pool.get('res.config').next(cr, uid, [], context) + diff --git a/addons/account/report/account_financial_report.py b/addons/account/report/account_financial_report.py index c3b1f5e2e1a..55794a304ab 100644 --- a/addons/account/report/account_financial_report.py +++ b/addons/account/report/account_financial_report.py @@ -58,12 +58,16 @@ class report_account_common(report_sxw.rml_parse, common_report_header): 'name': report.name, 'balance': report.balance, 'type': 'report', - 'level': report.level, + 'level': bool(report.style_overwrite) and report.style_overwrite or report.level, + 'account_type': report.type =='sum' and 'view' or False, #used to underline the financial report balances } if data['form']['enable_filter']: vals['balance_cmp'] = self.pool.get('account.financial.report').browse(self.cr, self.uid, report.id, context=data['form']['comparison_context']).balance lines.append(vals) account_ids = [] + if report.display_detail == 'no_detail': + #the rest of the loop is used to display the details of the financial report, so it's not needed here. + continue if report.type == 'accounts' and report.account_ids: account_ids = account_obj._get_children_and_consol(self.cr, self.uid, [x.id for x in report.account_ids]) elif report.type == 'account_type' and report.account_type_ids: diff --git a/addons/account/report/account_financial_report.rml b/addons/account/report/account_financial_report.rml index 4982c9b3bed..fe56c06a6cf 100644 --- a/addons/account/report/account_financial_report.rml +++ b/addons/account/report/account_financial_report.rml @@ -129,41 +129,29 @@ - - - - - - - - + + + + + + + + + + - - - - - + + + - - - - - - - - - - - - @@ -231,9 +219,11 @@ [[ 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))}) ]] - [[ (a.get('account_type') =='view' and a.get('level') >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.get('level')))+'_name'}) ]][[ a.get('name') ]] - [[ (a.get('level') <>2) or removeParentNode('td') ]][[ (a.get('account_type') =='view' and a.get('level') >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] - [[ a.get('level') == 2 or removeParentNode('td') ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] + [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_name'}) ]][[ a.get('name') ]] + [[ a.get('account_type') =='view' 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 removeParentNode('td') ]] + [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] @@ -256,11 +246,15 @@ [[ 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))}) ]] - [[ (a.get('account_type') =='view' and a.get('level') >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.get('level')))+'_name'}) ]][[ a.get('name') ]] - [[ (a.get('level') <>2) or removeParentNode('td') ]][[ (a.get('account_type') =='view' and a.get('level') >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] - [[ a.get('level') == 2 or removeParentNode('td') ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] - [[ (a.get('level') <>2) or removeParentNode('td') ]][[ (a.get('account_type') =='view' and a.get('level') >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]] - [[ a.get('level') == 2 or removeParentNode('td') ]][[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]] + [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_name'}) ]][[ a.get('name') ]] + [[ a.get('account_type') =='view' 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 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 removeParentNode('td') ]] + [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]] + [[ a.get('account_type') <>'view' or removeParentNode('td') ]] + [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]]