diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml index 4ca4c7159ad..25601f1c688 100644 --- a/addons/account/report/account_journal.rml +++ b/addons/account/report/account_journal.rml @@ -294,7 +294,7 @@ [[ line.name ]] [[ formatLang(line.debit) ]] [[ formatLang(line.credit) ]] - [[ formatLang(line.amount_currency) ]] [[ line.currency_code'] or '']] + [[ formatLang(line.amount_currency) ]] [[ line.currency_code or '']] diff --git a/addons/account/report/central_journal.py b/addons/account/report/central_journal.py index 0ebb894bb1d..03cb5943c6d 100644 --- a/addons/account/report/central_journal.py +++ b/addons/account/report/central_journal.py @@ -45,7 +45,8 @@ class journal_print(report_sxw.rml_parse, common_report_header): 'get_account': self._get_account, 'get_start_period': self.get_start_period, 'get_end_period': self.get_end_period, - 'get_sortby': self._get_sortby + 'get_sortby': self._get_sortby, + 'sum_currency_amount_account': self._sum_currency_amount_account, }) def set_context(self, objects, data, ids, report_type=None): # Improve move to common default? @@ -63,10 +64,30 @@ class journal_print(report_sxw.rml_parse, common_report_header): return super(journal_print, self).set_context(objects, data, ids, report_type) def lines(self, period_id, journal_id): - self.cr.execute('SELECT a.code, a.name, SUM(debit) AS debit, SUM(credit) AS credit from account_move_line l LEFT JOIN account_account a ON (l.account_id=a.id) WHERE l.period_id=%s AND l.journal_id=%s '+self.query_get_clause+' GROUP BY a.id, a.code, a.name', (period_id, journal_id)) + self.cr.execute('SELECT a.code, a.name, c.code AS currency_code, l.amount_currency ,SUM(debit) AS debit, SUM(credit) AS credit from account_move_line l LEFT JOIN account_account a ON (l.account_id=a.id) LEFT JOIN res_currency c on (l.currency_id=c.id)WHERE l.period_id=%s AND l.journal_id=%s '+self.query_get_clause+' GROUP BY a.id, a.code, a.name,l.amount_currency,c.code ', (period_id, journal_id)) res = self.cr.dictfetchall() return res + 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.central.journal', 'account.journal.period', 'addons/account/report/central_journal.rml', parser=journal_print, header=False) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/report/central_journal.rml b/addons/account/report/central_journal.rml index e634425fb46..8693088746a 100644 --- a/addons/account/report/central_journal.rml +++ b/addons/account/report/central_journal.rml @@ -121,6 +121,15 @@ + + + + + + + + + @@ -128,6 +137,15 @@ + + + + + + + + + @@ -137,6 +155,15 @@ + + + + + + + + + @@ -225,18 +252,27 @@ - + [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] - Account Num. + A/C No. Account Name Debit Credit + [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] + + A/C No. + Account Name + Debit + Credit + Currency + + - + [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] Total: @@ -244,12 +280,21 @@ [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)) ]] + [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] + + Total: + + [[ formatLang( sum_debit(o.period_id.id, o.journal_id.id)) ]] + [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)) ]] + [[formatLang(sum_currency_amount_account(o, data['form'])) ]] + +
[[ repeatIn(lines(o.period_id.id,o.journal_id.id),'line') ]] - + [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] [[ line['code'] ]] [[ line['name'] ]] @@ -257,6 +302,15 @@ [[ formatLang(line['credit'])]] + [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] + + [[ line['code'] ]] + [[ line['name'] ]] + [[ formatLang(line['debit']) ]] + [[ formatLang(line['credit'])]] + [[ formatLang(line['amount_currency']) ]] [[ line['currency_code'] or '']] + +