[IMP] account :Add currency_amount in genearl_ledger report
,Improve the journals report bzr revid: sbh@tinyerp.com-20100728110133-3e5mucn4swrwmp9b
This commit is contained in:
@@ -268,7 +268,7 @@
|
||||
<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_debit(o.period_id.id, o.journal_id.id) - sum_credit(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) - sum_debit(o.period_id.id, o.journal_id.id))) ]]</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>
|
||||
@@ -283,7 +283,7 @@
|
||||
</blockTable>
|
||||
|
||||
|
||||
<blockTable colWidths="50.0,65.0,50.0,60.0,89.0,40.0,60.0,50.0,60.0" style="Table1" repeatRows="1">[[ get_currency(data) or removeParentNode('blockTable') ]]
|
||||
<blockTable colWidths="50.0,65.0,50.0,60.0,89.0,40.0,60.0,50.0,60.0" style="Table1" repeatRows="1">[[ display_currency(data) or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td><para style="P10a">Date</para></td>
|
||||
<td><para style="P10">Voucher No</para></td>
|
||||
|
||||
@@ -84,15 +84,15 @@ class journal_print(report_sxw.rml_parse, common_report_header):
|
||||
def lines(self, period_id, journal_id=[]):
|
||||
if not self.journal_ids:
|
||||
return []
|
||||
self.cr.execute('SELECT j.code, j.name, l.amount_currency,c.code AS currency_code, '
|
||||
self.cr.execute('SELECT j.code, j.name, l.amount_currency,c.code AS currency_code,l.currency_id , '
|
||||
'SUM(l.debit) AS debit, SUM(l.credit) AS credit '
|
||||
'FROM account_move_line l '
|
||||
'LEFT JOIN account_journal j ON (l.journal_id=j.id) '
|
||||
'LEFT JOIN res_currency c on (l.currency_id=c.id)'
|
||||
'WHERE period_id=%s AND journal_id IN %s '+self.query_get_clause +''
|
||||
'GROUP BY j.id, j.code, j.name, l.amount_currency,c.code ',
|
||||
'GROUP BY j.id, j.code, j.name, l.amount_currency,c.code,l.currency_id ',
|
||||
(period_id, tuple(self.journal_ids)))
|
||||
|
||||
|
||||
return self.cr.dictfetchall()
|
||||
def _set_get_account_currency_code(self, account_id):
|
||||
self.cr.execute("SELECT c.code as code "\
|
||||
|
||||
@@ -314,7 +314,7 @@
|
||||
<para style="terp_default_Right_9">[[ formatLang(line['credit']) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(line['debit']-line['debit'] ) ]]</para>
|
||||
<para style="terp_default_Right_9">[[ formatLang(line['credit']-line['debit'] ) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
@@ -324,8 +324,8 @@
|
||||
<td><para style="terp_default_9">[[ line['name'] ]]</para></td>
|
||||
<td><para style="terp_default_Right_9">[[ formatLang(line['debit'] )]]</para></td>
|
||||
<td><para style="terp_default_Right_9">[[ formatLang(line['credit']) ]]</para></td>
|
||||
<td><para style="terp_default_Right_9">[[ formatLang(line['debit']-line['debit'] ) ]]</para></td>
|
||||
<td><para style="terp_default_Right_9">[[ formatLang(line['amount_currency'] or '') ]] [[ line['currency_code'] or '' ]]</para></td>
|
||||
<td><para style="terp_default_Right_9">[[ formatLang(line['credit']-line['debit'] ) ]]</para></td>
|
||||
<td><para style="terp_default_Right_9">[[ line['currency_id'] and formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]]</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_2">
|
||||
|
||||
@@ -60,6 +60,7 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
|
||||
'sum_debit_account': self._sum_debit_account,
|
||||
'sum_credit_account': self._sum_credit_account,
|
||||
'sum_balance_account': self._sum_balance_account,
|
||||
'sum_currency_amount_account': self._sum_currency_amount_account,
|
||||
'get_children_accounts': self.get_children_accounts,
|
||||
'get_fiscalyear': self._get_fiscalyear,
|
||||
'get_journal': self._get_journal,
|
||||
@@ -70,9 +71,24 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
|
||||
'get_sortby': self._get_sortby,
|
||||
'get_start_date':self._get_start_date,
|
||||
'get_end_date':self._get_end_date,
|
||||
|
||||
})
|
||||
self.context = context
|
||||
|
||||
def _sum_currency_amount_account(self, account, form):
|
||||
#FIXME: not working
|
||||
self.cr.execute("SELECT sum(l.amount_currency) as tot_currency "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s"%(account.id, self.query))
|
||||
sum_currency = self.cr.fetchone()[0] or 0.0
|
||||
if form.get('initial_balance', False):
|
||||
self.cr.execute("SELECT sum(l.amount_currency) as tot_currency "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s "%(account.id, form['initial_bal_query']))
|
||||
# Add initial balance to the result
|
||||
sum_currency += self.cr.fetchone()[0] or 0.0
|
||||
return str(sum_currency)
|
||||
|
||||
def get_children_accounts(self, account, form):
|
||||
res = []
|
||||
ids_acc = self.pool.get('account.account')._get_children_and_consol(self.cr, self.uid, account.id)
|
||||
|
||||
@@ -321,7 +321,7 @@
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_debit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_credit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td><para style="P9b"><u>[[formatLang(sum_balance_account(o, data['form'])) ]]</u></para></td>
|
||||
<td><para style="P9b"><u>[[o.currency_id and formatLang(sum_currency_amount_account(a, data['form']))+o.currency_id.code or '' ]]</u></para></td>
|
||||
<td><para style="P9b"><u>[[ o.currency_id and sum_currency_amount_account(o, data['form']) +o.currency_id.code or '' ]]</u></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user