[IMP] add the currency field in account_journal report
bzr revid: sbh@tinyerp.com-20100715062411-660imwxbtwlw5llr
This commit is contained in:
@@ -45,7 +45,8 @@ class journal_print(report_sxw.rml_parse, common_report_header):
|
||||
'get_account': self._get_account,
|
||||
'get_filter': self._get_filter,
|
||||
'get_start_date': self._get_start_date,
|
||||
'get_end_date': self._get_end_date
|
||||
'get_end_date': self._get_end_date,
|
||||
'sum_currency_amount_account': self._sum_currency_amount_account,
|
||||
})
|
||||
|
||||
def set_context(self, objects, data, ids, report_type=None): # Improve move to common default?
|
||||
@@ -72,6 +73,28 @@ class journal_print(report_sxw.rml_parse, common_report_header):
|
||||
ids = map(lambda x: x[0], self.cr.fetchall())
|
||||
return obj_mline.browse(self.cr, self.uid, ids)
|
||||
|
||||
def _set_get_account_currency_code(self, account_id):
|
||||
self.cr.execute("SELECT c.code as code "\
|
||||
"FROM res_currency c,account_account as ac "\
|
||||
"WHERE ac.id = %s AND ac.currency_id = c.id"%(account_id))
|
||||
result = self.cr.fetchone()
|
||||
if result:
|
||||
self.account_currency = result[0]
|
||||
else:
|
||||
self.account_currency = False
|
||||
|
||||
def _sum_currency_amount_account(self, account, form):
|
||||
self._set_get_account_currency_code(account.id)
|
||||
self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,))
|
||||
total = self.cr.fetchone()
|
||||
|
||||
if self.account_currency:
|
||||
return_field = str(total[0]) + self.account_currency
|
||||
return return_field
|
||||
else:
|
||||
currency_total = self.tot_currency = 0.0
|
||||
return currency_total
|
||||
|
||||
report_sxw.report_sxw('report.account.journal.period.print', 'account.journal.period', 'addons/account/report/account_journal.rml', parser=journal_print, header=False)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -235,7 +235,7 @@
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="65.0,62.0,58.0,62.0,174.0,57.0,61.0" style="Table1" repeatRows="1">
|
||||
<blockTable colWidths="65.0,62.0,58.0,62.0,174.0,57.0,61.0" style="Table1" repeatRows="1">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td><para style="P10a">Date</para></td>
|
||||
<td><para style="P10">Voucher No</para></td>
|
||||
@@ -264,5 +264,39 @@
|
||||
<td><para style="P8">[[ formatLang(line.credit) ]]</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
<blockTable colWidths="65.0,62.0,58.0,62.0,100.0,57.0,61.0,74.0" style="Table1" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td><para style="P10a">Date</para></td>
|
||||
<td><para style="P10">Voucher No</para></td>
|
||||
<td><para style="P10">A/c No.</para></td>
|
||||
<td><para style="P10a">Third party</para></td>
|
||||
<td><para style="P10a">Entry label</para></td>
|
||||
<td><para style="P10b">Debit</para></td>
|
||||
<td><para style="P10b">Credit</para></td>
|
||||
<td><para style="P10b">Currency</para></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para style="P11">[[o.period_id.name ]]</para></td>
|
||||
<td><para style="P11a">[[ o.journal_id.code ]]</para></td>
|
||||
<td><para style="P11"><font color="white"></font></para></td>
|
||||
<td><para style="P11"><font color="white"></font></para></td>
|
||||
<td><para style="P11"><font color="white"></font></para></td>
|
||||
<td><para style="P12"><u>[[ formatLang(sum_debit(o.period_id.id, o.journal_id.id)) ]]</u></para></td>
|
||||
<td><para style="P12"><u>[[ formatLang(sum_credit(o.period_id.id, o.journal_id.id)) ]]</u></para></td>
|
||||
<td><para style="P12"><u>[[formatLang(sum_currency_amount_account(o, data['form'])) ]]</u></para></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para style="terp_default_8">[[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]]</para><para style="terp_default_8">[[ formatLang(line.date,date=True) ]]</para></td>
|
||||
<td><para style="terp_default_Centre_8">[[ line.ref ]]</para></td>
|
||||
<td><para style="terp_default_Centre_8">[[ line.account_id.code ]]</para></td>
|
||||
<td><para style="terp_default_8">[[ line.partner_id and line.partner_id.name ]]</para></td>
|
||||
<td><para style="terp_default_8">[[ line.name ]]</para></td>
|
||||
<td><para style="P8">[[ formatLang(line.debit) ]]</para></td>
|
||||
<td><para style="P8">[[ formatLang(line.credit) ]]</para></td>
|
||||
<td><para style="P8">[[ formatLang(line.amount_currency) ]] [[ line.currency_code'] or '']]</para></td>
|
||||
|
||||
</tr>
|
||||
</blockTable>
|
||||
</story>
|
||||
</document>
|
||||
|
||||
Reference in New Issue
Block a user