From ba7d2d38bef90e7d4efaa253ddfd137c822d1128 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Tue, 20 Jul 2010 15:18:53 +0530 Subject: [PATCH] [IMP] account: rename the function, imporve the report and add the header in thrid_party_ledger bzr revid: sbh@tinyerp.com-20100720094853-6u7ad7o9ulvrqbpu --- addons/account/report/general_journal.py | 4 +- addons/account/report/general_journal.rml | 8 +- addons/account/report/partner_balance.rml | 3 +- addons/account/report/third_party_ledger.py | 24 ++++++ .../report/third_party_ledger_other.rml | 76 +++++++++++++++++++ 5 files changed, 107 insertions(+), 8 deletions(-) diff --git a/addons/account/report/general_journal.py b/addons/account/report/general_journal.py index b4df6939f70..3a9917c4f21 100644 --- a/addons/account/report/general_journal.py +++ b/addons/account/report/general_journal.py @@ -53,7 +53,7 @@ class journal_print(report_sxw.rml_parse, common_report_header): 'get_journal': self._get_journal, 'get_start_date':self._get_start_date, 'get_end_date':self._get_end_date, - 'print_data':self._print_data, + 'get_currency ':self.get_currency }) def set_context(self, objects, data, ids, report_type=None): # Improve move to common default? @@ -126,7 +126,7 @@ class journal_print(report_sxw.rml_parse, common_report_header): return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).fiscalyear_id.name return super(journal_print ,self)._get_fiscalyear(data) - def _print_data(self, data): + def _get_currency(self, data): if data['model']=='account.journal.period': return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).journal_id.currency or False return data['form']['amount_currency'] diff --git a/addons/account/report/general_journal.rml b/addons/account/report/general_journal.rml index b2c976878e5..433639ed084 100644 --- a/addons/account/report/general_journal.rml +++ b/addons/account/report/general_journal.rml @@ -287,7 +287,7 @@ - [[ print_data(data)==False or removeParentNode('blockTable') ]] + [[ get_currency(data)==False or removeParentNode('blockTable') ]] Code Journal Name @@ -305,7 +305,7 @@ [[ formatLang( sum_debit()- sum_credit()) ]] - [[ print_data(data) or removeParentNode('blockTable') ]] + [[ get_currency(data) or removeParentNode('blockTable') ]] Code Journal Name @@ -327,7 +327,7 @@
- [[ print_data(data) == False or removeParentNode('blockTable') ]] + [[ get_currency(data) == False or removeParentNode('blockTable') ]] [[ repeatIn(lines(o.id),'line')]] [[ line['code'] ]] @@ -349,7 +349,7 @@ - [[print_data(data) or removeParentNode('blockTable') ]] + [[ get_currency(data) or removeParentNode('blockTable') ]] [[ repeatIn(lines(o.id),'line')]] [[ line['code'] ]] [[ line['name'] ]] diff --git a/addons/account/report/partner_balance.rml b/addons/account/report/partner_balance.rml index ed928faebaf..8f0edb7e887 100644 --- a/addons/account/report/partner_balance.rml +++ b/addons/account/report/partner_balance.rml @@ -41,8 +41,7 @@ - - + diff --git a/addons/account/report/third_party_ledger.py b/addons/account/report/third_party_ledger.py index b299182cd6e..083a8235f60 100644 --- a/addons/account/report/third_party_ledger.py +++ b/addons/account/report/third_party_ledger.py @@ -43,6 +43,18 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header): 'sum_credit': self._sum_credit, 'get_currency': self._get_currency, 'comma_me' : self.comma_me, + 'get_start_period': self.get_start_period, + 'get_end_period': self.get_end_period, + 'get_account': self._get_account, + 'get_filter': self._get_filter, + 'get_start_date': self._get_start_date, + 'get_end_date': self._get_end_date, + 'sum_currency_amount_account': self._sum_currency_amount_account, + 'get_fiscalyear': self._get_fiscalyear, + 'get_start_date':self._get_start_date, + 'get_end_date':self._get_end_date, + 'get_journal': self._get_journal, + }) def date_range(self, start, end): @@ -398,6 +410,18 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header): def _get_currency(self, form): return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name + 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.third_party_ledger', 'res.partner', 'addons/account/report/third_party_ledger.rml',parser=third_party_ledger, header=False) diff --git a/addons/account/report/third_party_ledger_other.rml b/addons/account/report/third_party_ledger_other.rml index 296d310fcd9..2f85d2101e4 100644 --- a/addons/account/report/third_party_ledger_other.rml +++ b/addons/account/report/third_party_ledger_other.rml @@ -37,6 +37,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -101,6 +133,50 @@ + + + + Company [[ data['model']=='account.journal.period' or removeParentNode('para') ]] + Chart of Account [[ data['model']=='ir.ui.menu' or removeParentNode('para') ]] + Fiscal Year + Journal + Filters By + Printing Date + + + [[ get_account(data) or '' ]] + [[ get_fiscalyear(data) or '' ]] + [[', '.join([ lt or '' for lt in get_journal(data) ]) ]] + [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] + [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + + Start Date + End Date + + + [[ get_start_date(data) ]] + [[ get_end_date(data) ]] + + + [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + + Start Period + End Period + + + [[ get_start_period(data) or removeParentNode('para') ]] + [[ get_end_period(data) or removeParentNode('para') ]] + + + + [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] + + + + + + +