[IMP][ADD] account: added leveling and calculating balance of view type of account in general ledger report.

bzr revid: vra@tinyerp.com-20100921093857-e2k9aiywzl2sr0zb
This commit is contained in:
vra
2010-09-21 15:08:57 +05:30
parent c5944b3c70
commit a95005cc4c
3 changed files with 20 additions and 5 deletions
@@ -44,6 +44,15 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
self.init_balance = data['form']['initial_balance']
self.display_account = data['form']['display_account']
self.target_move = data['form'].get('target_move', 'all')
ctx = self.context.copy()
ctx['fiscalyear'] = data['form']['fiscalyear_id']
if data['form']['filter'] == 'filter_period':
ctx['periods'] = data['form']['periods']
elif data['form']['filter'] == 'filter_date':
ctx['date_from'] = data['form']['date_from']
ctx['date_to'] = data['form']['date_to']
ctx['state'] = data['form']['target_move']
self.context.update(ctx)
if (data['model'] == 'ir.ui.menu'):
new_ids = [data['form']['chart_account_id']]
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
@@ -93,7 +102,7 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
def get_children_accounts(self, account):
res = []
ids_acc = self.pool.get('account.account')._get_children_and_consol(self.cr, self.uid, account.id)
for child_account in self.pool.get('account.account').browse(self.cr, self.uid, ids_acc):
for child_account in self.pool.get('account.account').browse(self.cr, self.uid, ids_acc, context=self.context):
sql = """
SELECT count(id)
FROM account_move_line AS l
@@ -203,6 +212,8 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
return res
def _sum_debit_account(self, account):
if account.type == 'view':
return account.debit
move_state = ['draft','posted']
if self.target_move == 'posted':
move_state = ['posted','']
@@ -227,6 +238,8 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
return sum_debit
def _sum_credit_account(self, account):
if account.type == 'view':
return account.credit
move_state = ['draft','posted']
if self.target_move == 'posted':
move_state = ['posted','']
@@ -251,6 +264,8 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
return sum_credit
def _sum_balance_account(self, account):
if account.type == 'view':
return account.balance
move_state = ['draft','posted']
if self.target_move == 'posted':
move_state = ['posted','']
@@ -256,7 +256,7 @@
<td>
<blockTable colWidths="245.0,92.5,66.5,64.5,71.5" style="Table5">
<tr>
<td><para style="Standard">[[ o.code or '']] [[ o.name or '']]</para></td>
<td><para style="Standard"><font color="white">[[ '..'*(o.level-1) ]]</font>[[ o.code or '']] [[ o.name or '']]</para></td>
<td><para style="Standard"></para></td>
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_debit_account(o)) ]]</u></para></td>
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_credit_account(o)) ]] </u></para></td>
@@ -307,7 +307,7 @@
<td>
<blockTable colWidths="230.00,74.0,55.5,60.5,60.5,65.5" style="Table5">
<tr>
<td><para style="Standard">[[ o.code or '' ]] [[ o.name or '' ]]</para></td>
<td><para style="Standard"><font color="white">[[ '..'*(o.level-1) ]]</font>[[ o.code or '' ]] [[ o.name or '' ]]</para></td>
<td><para style="Standard"></para></td>
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_debit_account(o)) ]]</u></para></td>
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_credit_account(o)) ]]</u></para></td>
@@ -264,7 +264,7 @@
<td>
<blockTable colWidths="404.0,335.0,75.0,75.0,75.0,79.00" style="Table5">
<tr>
<td><para style="Standard">[[ o.code ]] [[ o.name ]]</para></td>
<td><para style="Standard"><font color="white">[[ '..'*(o.level-1) ]]</font>[[ o.code ]] [[ o.name ]]</para></td>
<td><para style="Standard"></para></td>
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_debit_account(o)) ]]</u></para></td>
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_credit_account(o)) ]]</u></para></td>
@@ -325,7 +325,7 @@
<td>
<blockTable colWidths="405.0,435.0,69.0,72.0,64.0" style="Table5">
<tr>
<td><para style="Standard">[[ o.code ]] [[ o.name ]]</para></td>
<td><para style="Standard"><font color="white">[[ '..'*(o.level-1) ]]</font>[[ o.code ]] [[ o.name ]]</para></td>
<td><para style="Standard"></para></td>
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_debit_account(o)) ]]</u></para></td>
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_credit_account(o)) ]]</u></para></td>