From c844cb41e08d841ab3aa60380659f1ba593597d5 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 31 Aug 2011 13:54:59 +0200 Subject: [PATCH] [IMP] account, low level reports: layout improvements bzr revid: qdp-launchpad@openerp.com-20110831115459-ncrctqr0ms4w919y --- addons/account/account.py | 10 ++++ .../report/account_low_level_report.py | 3 +- .../report/account_low_level_report.rml | 53 +++++++++---------- 3 files changed, 36 insertions(+), 30 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index ac14f0d7abe..8c433b8591b 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2611,6 +2611,15 @@ class account_low_level_report(osv.osv): _name = "account.low.level.report" _description = "Account Report" + def _get_level(self, cr, uid, ids, field_name, arg, context=None): + res = {} + for report in self.browse(cr, uid, ids, context=context): + level = 0 + if report.parent_id: + level = report.parent_id.level + 1 + res[report.id] = level + return res + def _get_children_by_order(self, cr, uid, ids, context=None): res = [] for id in ids: @@ -2659,6 +2668,7 @@ class account_low_level_report(osv.osv): 'account_report_id': fields.many2one('account.low.level.report', 'Account Report'), 'balance': fields.function(_get_balance, 'Balance'), 'display_detail': fields.boolean('Display the account list'), + 'level': fields.function(_get_level, string='Level', store=True, type='integer'), } _defaults = { diff --git a/addons/account/report/account_low_level_report.py b/addons/account/report/account_low_level_report.py index 3f834921f86..b1a4bee74b3 100644 --- a/addons/account/report/account_low_level_report.py +++ b/addons/account/report/account_low_level_report.py @@ -100,6 +100,7 @@ class report_account_common(report_sxw.rml_parse, common_report_header): 'name': report.name, 'balance': report.balance, 'type': 'report', + 'level': report.level, } if data['form']['enable_filter']: vals['balance_cmp'] = self.pool.get('account.low.level.report').browse(self.cr, self.uid, report.id, context=data['form']['comparison_context']).balance @@ -111,7 +112,7 @@ class report_account_common(report_sxw.rml_parse, common_report_header): 'name': account.code + ' ' + account.name, 'balance': account.balance, 'type': 'account', - 'level': account.level, + 'level': 6, 'account_type': account.type, } if data['form']['enable_filter']: diff --git a/addons/account/report/account_low_level_report.rml b/addons/account/report/account_low_level_report.rml index a8487862ea5..8dd92335266 100644 --- a/addons/account/report/account_low_level_report.rml +++ b/addons/account/report/account_low_level_report.rml @@ -125,20 +125,20 @@ - + + - - - - - - - + + - + + + + + @@ -172,7 +172,7 @@ - Account Report + [[ data['form']['account_report_id'][1] ]] @@ -219,8 +219,7 @@ - Reports - + [[ data['form']['enable_filter'] == 0 or removeParentNode('blockTable') ]] @@ -230,15 +229,13 @@ Balance - + [[ repeatIn(get_lines(data), 'a') ]] - [[ setTag('tr','tr',{'style': 'Table'+str(min(3,'level' in a and a.get('level') or 1))}) or removeParentNode('tr') ]] - [[ a.get('type')=='report' and a.get('name') or removeParentNode('td') ]] - [[ a.get('type')=='report' and formatLang(a.get('balance')) or removeParentNode('td') ]][[company.currency_id.symbol ]] - [[ a.get('type') == 'account' and a.get('name') or removeParentNode('td') ]] - [[ a.get('type')=='account' and (a.get('account_type')=='view' and a.get('level',1) >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level',1)))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.get('level',1)))+'_name'}) ]] - [[ a.get('type')=='account' and (a.get('level',1) <>2) or removeParentNode('td') ]][[ (a.get('account_type') == 'view' and a.get('level',1) >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level',1)))+'_balance'}) ]][[ formatLang(a.get('balance')) ]][[company.currency_id.symbol ]] - [[ a.get('type')=='account' and a.get('level',1) == 2 or removeParentNode('td') ]][[ formatLang(a.get('balance')) ]] [[company.currency_id.symbol ]] + [[ (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['level']))+'_name'}) ]] [[ a.get('name') ]] + [[ a.get('level') == 4 or removeParentNode('td') ]][[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_balance'}) ]][[ formatLang(a.get('balance'))]] [[company.currency_id.symbol]] + [[ a.get('level') <> 4 or removeParentNode('td') ]][[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_balance'}) ]][[ formatLang(a.get('balance'))]] [[company.currency_id.symbol]] @@ -259,15 +256,13 @@ [[ repeatIn(get_lines(data), 'a') ]] - [[ a.get('type')=='report' and a.get('name') or removeParentNode('td') ]] - [[ a.get('type')=='report' and formatLang(a.get('balance')) or removeParentNode('td') ]][[company.currency_id.symbol ]] - [[ a.get('type')=='report' and formatLang(a.get('balance_cmp')) or removeParentNode('td') ]][[company.currency_id.symbol ]] - [[ a.get('type') == 'account' and a.get('name') or removeParentNode('td') ]] - [[ a.get('type')=='account' and (a.get('account_type')=='view' and a.get('level',1) >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level',1)))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.get('level',1)))+'_name'}) ]] - [[ a.get('type')=='account' and (a.get('level',1) <>2) or removeParentNode('td') ]][[ (a.get('account_type') == 'view' and a.get('level',1) >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level',1)))+'_balance'}) ]][[ formatLang(a.get('balance')) ]][[company.currency_id.symbol ]] - [[ a.get('type')=='account' and a.get('level',1) == 2 or removeParentNode('td') ]][[ formatLang(a.get('balance')) ]] [[company.currency_id.symbol ]] - [[ a.get('type')=='account' and (a.get('level',1) <>2) or removeParentNode('td') ]][[ (a.get('account_type') == 'view' and a.get('level',1) >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level',1)))+'_balance'}) ]][[ formatLang(a.get('balance_cmp')) ]][[company.currency_id.symbol ]] - [[ a.get('type')=='account' and a.get('level',1) == 2 or removeParentNode('td') ]][[ formatLang(a.get('balance_cmp')) ]] [[company.currency_id.symbol ]] + [[ (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['level']))+'_name'}) ]] [[ a.get('name') ]] + [[ a.get('level') == 4 or removeParentNode('td') ]][[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_balance'}) ]][[ formatLang(a.get('balance'))]] [[company.currency_id.symbol]] + [[ a.get('level') <> 4 or removeParentNode('td') ]][[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_balance'}) ]][[ formatLang(a.get('balance'))]] [[company.currency_id.symbol]] + [[ a.get('level') == 4 or removeParentNode('td') ]][[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'))]] [[company.currency_id.symbol]] + [[ a.get('level') <> 4 or removeParentNode('td') ]][[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a['level']))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'))]] [[company.currency_id.symbol]]