diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index 05a15c6f666..4f82e9bd4e9 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -69,12 +69,24 @@ class account_balance(report_sxw.rml_parse): 'level': level, 'debit': account.debit, 'credit': account.credit, - 'balance': account.balance + 'balance': account.balance, + 'leef': not bool(account.child_id) } self.sum_debit += account.debit self.sum_credit += account.credit if not (res['credit'] or res['debit']) and not account.child_id: continue + if account.child_id: + def _check_rec(account): + if not account.child_id: + return bool(account.credit or account.debit) + for c in account.child_id: + if _check_rec(c): + return True + return False + if not _check_rec(account): + continue + result.append(res) if account.child_id: ids2 = [(x.code,x.id) for x in account.child_id] diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index 1daa0d43daa..8deeabb6ba7 100644 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -38,21 +38,9 @@ - + - - - - - - - - - - - - - + @@ -97,70 +85,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - Account balance - - - - - - - - - - [[ company.name ]] - - - - - - - - Currency: [[ company.currency_id.name ]] - - - - - - Printing date: [[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]] at [[ time.strftime('%H:%M:%S') ]] - - - - + - Code + Code - Account name - - - Transactions - - - Balance - - - - - - - - - + Account Debit @@ -169,58 +155,27 @@ Credit - - - + Balance - - - - - + [[ repeatIn(lines(data['form']), 'a') ]][[ a['code'] ]] - [[ repeatIn(lines(data['form']), 'a') ]][[ a['code'] ]] + [[ setTag('tr','tr',{'style':'TrLevel'+str(a['level']), 'paraStyle':('Level'+str(a['level']))}) ]] + [[ a['name'] ]] - [[ '. '*(a['level']-1) + a['name'] ]] + [[ formatLang(a['debit'] or '') ]] - [[ formatLang(a['debit']) ]] + [[ formatLang(a['credit'] or '') ]] - [[ formatLang(a['credit']) ]] - - - [[ formatLang(a['balance']) ]] + [[ (a['leef'] and removeParentNode('para')) or formatLang(a['balance'] or '') ]] + [[ ((not a['leef']) and removeParentNode('para')) or formatLang(a['balance'] or '') ]] - - - - - - - Total: - - - [[ formatLang(sum_debit()) ]] - - - [[ formatLang(sum_credit()) ]] - - - - - - - - - - -