[IMP] account: Improve the account report

bzr revid: sbh@tinyerp.com-20100716110748-6z4o4vkk9p3vwfoi
This commit is contained in:
sbh (Open ERP) 2010-07-16 16:37:48 +05:30
parent 61aa9034d6
commit 9ecfe0c16c
4 changed files with 12 additions and 7 deletions

View File

@ -127,5 +127,10 @@ class common_report_header(object):
if data.get('form', False) and data['form'].get('company_id', False):
comp_obj = pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, data['form']['company_id'])
return comp_obj.name
def _get_journal(self, journal_ids):
self.cr.execute('select code from account_journal where id IN %s',(tuple(journal_ids),))
codes = [x for x, in self.cr.fetchall()]
return codes or ''
#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -49,7 +49,8 @@ class journal_print(report_sxw.rml_parse, common_report_header):
'get_end_period': self.get_end_period,
'get_sortby': self._get_sortby,
'sum_currency_amount_account': self._sum_currency_amount_account,
'get_filter': self._get_filter,
'get_filter': self._get_filter,
'get_journal': self._get_journal,
})
def set_context(self, objects, data, ids, report_type=None): # Improve move to common default?

View File

@ -245,16 +245,18 @@
</td>
</tr>
</blockTable>
<blockTable colWidths="120.0,80.0,150.0,100.0" style="Table2">
<blockTable colWidths="80.0,100,80.0,150.0,100.0" style="Table2">
<tr>
<td><para style="terp_tblheader_General_Centre">Chat Account</para></td>
<td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td>
<td><para style="terp_tblheader_General_Centre">Journals</para></td>
<td><para style="terp_tblheader_General_Centre">Filters By <font>[[ get_filter(data)!='No Filter' and '' or removeParentNode('font') ]]</font></para></td>
<td><para style="terp_tblheader_General_Centre">Printing Date</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ get_account(data) or removeParentNode('para') ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_fiscalyear(data) or removeParentNode('para') ]]</para></td>
<td> <para style="terp_default_Centre_8">[[', '.join([ lt or '' for lt in get_journal(data['form']['journal_ids']) ]) ]] </para></td>
<td><para style="terp_default_Centre_8">[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] </para>
<blockTable colWidths="60.0,60.0" style="Table3">[[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
<tr>
@ -319,7 +321,7 @@
<td><para style="terp_default_Bold_9_Right">[[ formatLang(sum_debit()) ]]</para></td>
<td><para style="terp_default_Bold_9_Right">[[ formatLang( sum_credit()) ]]</para></td>
<td><para style="terp_default_Bold_9_Right">[[ formatLang( sum_debit()- sum_credit()) ]]</para></td>
<td><para style="terp_default_Bold_9_Right"><u>[[ o.currency_id and formatLang(sum_currency_amount_account(o, data['form'])) +o.currency_id.code or '' ]]</u></para></td>
<td><para style="terp_default_Bold_9_Right"><u>[[ formatLang(sum_currency_amount_account(o, data['form'])) or '' ]]</u></para></td>
</tr>
</blockTable>

View File

@ -227,10 +227,7 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
# Add initial balance to the result
sum_currency += self.cr.fetchone()[0] or 0.0
return str(sum_currency)
def _get_journal(self, journal_ids):
self.cr.execute('select code from account_journal where id IN %s',(tuple(journal_ids),))
codes = [x for x, in self.cr.fetchall()]
return codes or ''
report_sxw.report_sxw('report.account.general.ledger', 'account.account', 'addons/account/report/general_ledger.rml', parser=general_ledger, header='internal')
report_sxw.report_sxw('report.account.general.ledger_landscape', 'account.account', 'addons/account/report/general_ledger_landscape.rml', parser=general_ledger, header='internal')