From bac6c9af574f9d1efb27018954813883286c9708 Mon Sep 17 00:00:00 2001 From: pso Date: Tue, 29 Jun 2010 19:11:09 +0530 Subject: [PATCH 1/2] [IMP] account : improved header of account balance report bzr revid: pso@tinyerp.com-20100629134109-eobm80ohil559o23 --- addons/account/report/account_balance.rml | 78 +++++++++++++++-------- 1 file changed, 53 insertions(+), 25 deletions(-) diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index af4cee7a7ba..f10b66f0a8d 100644 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -85,24 +85,33 @@ + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -121,7 +130,8 @@ - + + @@ -140,7 +150,10 @@ - + + + + - - + + + + Account Balance + + + + + + + Fiscal Year - End Date + Start Date - Start Date + End Date Display Account @@ -182,24 +204,30 @@ Periods + + Printing Date + - + - [[ get_fiscalyear(data['form']) ]] + [[ get_fiscalyear(data['form']) ]] - [[ data['form']['date_from'] ]] + [[ data['form']['date_from'] ]] - [[ data['form']['date_to'] ]] + [[ data['form']['date_to'] ]] - [[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_mouvement' and 'With movements') or 'With balance is not equal to 0']] + [[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_mouvement' and 'With movements') or 'With balance is not equal to 0']] - [[data['form']['periods'] and get_periods(data['form']) or '']] + [[data['form']['periods'] and get_periods(data['form']) or '']] + + + [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] From 7b65188522551cc525bb334abfcabdb643ad176d Mon Sep 17 00:00:00 2001 From: pso Date: Tue, 29 Jun 2010 19:18:46 +0530 Subject: [PATCH 2/2] [IMP] account : improved header of account reports bzr revid: pso@tinyerp.com-20100629134846-krmbzc1i4znjupol --- addons/account/report/account_journal.py | 16 +- addons/account/report/account_journal.rml | 121 ++++++++++++++- addons/account/report/central_journal.py | 13 +- addons/account/report/general_journal.py | 9 ++ addons/account/report/general_ledger.py | 19 ++- addons/account/report/general_ledger.rml | 132 +++++++++++++++- .../report/general_ledger_landscape.rml | 141 ++++++++++++++++++ addons/account/report/partner_balance.py | 32 +++- addons/account/report/partner_balance.rml | 127 +++++++++++++++- .../account/report/wizard_central_journal.rml | 39 ++++- .../account/report/wizard_general_journal.rml | 66 ++++++-- .../wizard/account_partner_balance_report.py | 4 +- 12 files changed, 693 insertions(+), 26 deletions(-) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index d401c1ba8e1..6de6e3cad6e 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -20,7 +20,7 @@ ############################################################################## import time - +import pooler from report import report_sxw # @@ -42,7 +42,10 @@ class journal_print(report_sxw.rml_parse): 'time': time, 'lines': self.lines, 'sum_debit': self._sum_debit, - 'sum_credit': self._sum_credit + 'sum_credit': self._sum_credit, + 'get_start_period': self.get_start_period, + 'get_end_period': self.get_end_period, + 'get_account': self.get_account }) def lines(self, period_id, journal_id, sort_selection='date', *args): @@ -61,6 +64,15 @@ class journal_print(report_sxw.rml_parse): def _sum_credit(self, period_id, journal_id): self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id=%s'+self.query_get_clause+' and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 + + def get_start_period(self, form): + return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_from']).name + + def get_end_period(self, form): + return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_to']).name + + def get_account(self, form): + return pooler.get_pool(self.cr.dbname).get('account.account').browse(self.cr,self.uid,form['chart_account_id']).name 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: diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml index 797513a06ad..b882c6011a7 100644 --- a/addons/account/report/account_journal.rml +++ b/addons/account/report/account_journal.rml @@ -37,6 +37,10 @@ + + + + @@ -56,11 +60,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - @@ -118,6 +188,53 @@ [[ repeatIn(objects, 'o') ]] + + + + + + + Print Journal + + + + + + + + + + + + + Start Date + End Date + Entries Sorted By + Account + Start Period + End Period + Filters By + Printing Date + + + + + [[ data['form']['date_from'] ]] + [[ data['form']['date_to'] ]] + [[ data['form']['sort_selection'] ]] + [[ get_account(data['form']) ]] + [[ get_start_period(data['form']) or removeParentNode('para') ]] + [[ get_end_period(data['form']) or removeParentNode('para') ]] + [[ data['form']['filter'] ]] + [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time = True) ]] + + + + + + + + Date diff --git a/addons/account/report/central_journal.py b/addons/account/report/central_journal.py index 64a76ad863b..a805b896d6c 100644 --- a/addons/account/report/central_journal.py +++ b/addons/account/report/central_journal.py @@ -21,6 +21,7 @@ import time from report import report_sxw +import pooler # # Use period and Journal for selection or resources @@ -32,7 +33,9 @@ class journal_print(report_sxw.rml_parse): 'time': time, 'lines': self.lines, 'sum_debit': self._sum_debit, - 'sum_credit': self._sum_credit + 'sum_credit': self._sum_credit, + 'get_start_date': self.get_start_date, + 'get_end_date': self.get_end_date }) def lines(self, period_id, journal_id, *args): @@ -60,6 +63,14 @@ class journal_print(report_sxw.rml_parse): def _sum_credit(self, period_id, journal_id): self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 + + def get_start_date(self, form): + return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_from']).name + + def get_end_date(self, form): + return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_to']).name + + report_sxw.report_sxw('report.account.central.journal', 'account.journal.period', 'addons/account/report/central_journal.rml', parser=journal_print, header=False) report_sxw.report_sxw('report.account.central.journal.wiz', 'account.journal.period', 'addons/account/report/wizard_central_journal.rml', parser=journal_print, header=False) diff --git a/addons/account/report/general_journal.py b/addons/account/report/general_journal.py index d19cd80a176..aa8248130f2 100644 --- a/addons/account/report/general_journal.py +++ b/addons/account/report/general_journal.py @@ -37,6 +37,8 @@ class journal_print(report_sxw.rml_parse): 'sum_credit_period': self._sum_credit_period, 'sum_debit': self._sum_debit, 'sum_credit': self._sum_credit, + 'get_start_date': self.get_start_date, + 'get_end_date': self.get_end_date }) def set_context(self, objects, data, ids, report_type=None): @@ -120,5 +122,12 @@ class journal_print(report_sxw.rml_parse): 'AND state<>\'draft\'', (tuple(periods), tuple(journals))) return self.cr.fetchone()[0] or 0.0 + + def get_start_date(self, form): + return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_from']).name + + def get_end_date(self, form): + return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_to']).name + report_sxw.report_sxw('report.account.general.journal', 'account.journal.period', 'addons/account/report/general_journal.rml', parser=journal_print, header=False) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/report/general_ledger.py b/addons/account/report/general_ledger.py index 195d6bc5746..9442efc1db3 100644 --- a/addons/account/report/general_ledger.py +++ b/addons/account/report/general_ledger.py @@ -63,7 +63,11 @@ class general_ledger(rml_parse.rml_parse): 'sum_credit': self._sum_credit, 'sum_solde': self._sum_solde, 'get_children_accounts': self.get_children_accounts, - 'sum_currency_amount_account': self._sum_currency_amount_account + 'sum_currency_amount_account': self._sum_currency_amount_account, + 'get_fiscalyear': self.get_fiscalyear, + 'get_account': self.get_account, + 'get_start_period': self.get_start_period, + 'get_end_period': self.get_end_period, }) self.context = context @@ -320,6 +324,19 @@ class general_ledger(rml_parse.rml_parse): else: currency_total = self.tot_currency = 0.0 return currency_total + + def get_fiscalyear(self,form): + print "formmmmmmmmmm", form + return pooler.get_pool(self.cr.dbname).get('account.fiscalyear').browse(self.cr,self.uid,form['fiscalyear_id']).name + + def get_account(self,form): + return pooler.get_pool(self.cr.dbname).get('account.account').browse(self.cr,self.uid,form['chart_account_id']).name + + def get_start_period(self, form): + return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_from']).name + + def get_end_period(self, form): + return pooler.get_pool(self.cr.dbname).get('account.period').browse(self.cr,self.uid,form['period_to']).name report_sxw.report_sxw('report.account.general.ledger', 'account.account', 'addons/account/report/general_ledger.rml', parser=general_ledger, header=False) report_sxw.report_sxw('report.account.general.ledger_landscape', 'account.account', 'addons/account/report/general_ledger_landscape.rml', parser=general_ledger, header=False) diff --git a/addons/account/report/general_ledger.rml b/addons/account/report/general_ledger.rml index c66f0eba502..fe0fefb8355 100644 --- a/addons/account/report/general_ledger.rml +++ b/addons/account/report/general_ledger.rml @@ -38,7 +38,10 @@ - + + + + @@ -46,6 +49,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -74,6 +149,7 @@ + @@ -82,15 +158,69 @@ + + + + + + + + + General Ledger + + + + + + + [[ repeatIn(objects, 'a') ]] + + + + Start Date + End Date + Fiscal Year + Entries Sorted By + Account + Start Period + End Period + Filters By + Printing Date + + + + + [[ data['form']['date_from'] ]] + [[ data['form']['date_to'] ]] + [[ get_fiscalyear(data['form']) ]] + [[ data['form']['sortby'] ]] + [[ get_account(data['form']) ]] + [[ get_start_period(data['form']) or removeParentNode('para') ]] + [[ get_end_period(data['form']) or removeParentNode('para') ]] + [[ data['form']['filter'] ]] + [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time = True) ]] + + + + + + + + + + + + + [[data['form']['amount_currency'] == False or removeParentNode('blockTable')]] Date diff --git a/addons/account/report/general_ledger_landscape.rml b/addons/account/report/general_ledger_landscape.rml index 14e7d6b8c4c..14cbb1e3fbd 100644 --- a/addons/account/report/general_ledger_landscape.rml +++ b/addons/account/report/general_ledger_landscape.rml @@ -38,6 +38,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -65,6 +141,8 @@ + + @@ -79,10 +157,71 @@ + + + + + + + + General Ledger With Landscape Mode + + + + + + [[ repeatIn(objects, 'a') ]] + + + + + + + + + + + + + + Start Date + End Date + Fiscal Year + Entries Sorted By + Account + Start Period + End Period + Filters By + Printing Date + + + + + [[ data['form']['date_from'] ]] + [[ data['form']['date_to'] ]] + [[ get_fiscalyear(data['form']) ]] + [[ data['form']['sortby'] ]] + [[ get_account(data['form']) ]] + [[ get_start_period(data['form']) or removeParentNode('para') ]] + [[ get_end_period(data['form']) or removeParentNode('para') ]] + [[ data['form']['filter'] ]] + [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time = True) ]] + + + + + + + + + + + + [[data['form']['amount_currency'] == True or removeParentNode('blockTable')]] @@ -100,6 +239,8 @@ + +
[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] diff --git a/addons/account/report/partner_balance.py b/addons/account/report/partner_balance.py index 142375aedb5..3b458127fb7 100644 --- a/addons/account/report/partner_balance.py +++ b/addons/account/report/partner_balance.py @@ -43,11 +43,35 @@ class partner_balance(report_sxw.rml_parse): 'get_company': self._get_company, 'get_currency': self._get_currency, 'comma_me' : self.comma_me, + 'get_fiscalyear': self.get_fiscalyear, + 'get_periods':self.get_periods, }) ## Compute account list one time # # Date Management # + + def get_periods(self, form): + result='' + if form.has_key('periods') and form['periods']: + period_ids = form['periods'] + per_ids = self.pool.get('account.period').browse(self.cr, self.uid, form['periods']) + for r in per_ids: + if r == per_ids[len(per_ids)-1]: + result+=r.name+". " + else: + result+=r.name+", " + else: + fy_obj = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear']) + res = fy_obj.period_ids + len_res = len(res) + for r in res: + if r == res[len_res-1]: + result+=r.name+". " + else: + result+=r.name+", " + return str(result and result[:-1]) or 'ALL' + def date_range(self, start, end): if not start or not end: return [] @@ -294,7 +318,7 @@ class partner_balance(report_sxw.rml_parse): new_header['enlitige'] = tot_enlitige new_header['balance'] = float(tot_sdebit) - float(tot_scredit) new_header['type'] = 3 - ## + ##get_fiscalyear ## completearray.append(new_header) @@ -468,8 +492,12 @@ class partner_balance(report_sxw.rml_parse): 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 get_fiscalyear(self,form): + print "ffffffffffffff",form + return pooler.get_pool(self.cr.dbname).get('account.fiscalyear').browse(self.cr,self.uid,form['fiscalyear']).name + report_sxw.report_sxw('report.account.partner.balance', 'res.partner', 'account/report/partner_balance.rml',parser=partner_balance, - header=False) + header=0) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/report/partner_balance.rml b/addons/account/report/partner_balance.rml index ff6e1214a1b..801125b5669 100644 --- a/addons/account/report/partner_balance.rml +++ b/addons/account/report/partner_balance.rml @@ -56,6 +56,10 @@ + + + + @@ -80,6 +84,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -95,11 +148,13 @@ - + + + @@ -284,7 +339,77 @@ /> + + + + + + + + + Partner Balance + + + + + + + + + + Partner + + + Fiscal Year + + + Start Date + + + End Date + + + Periods + + + Printing Date + + + + + + + + [[ data['form']['result_selection'] ]] + + + [[ get_fiscalyear(data['form']) ]] + + + [[ data['form']['date1'] ]] + + + [[ data['form']['date2'] ]] + + + [[data['form']['periods'] and get_periods(data['form']) or '']] + + + [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time = True) ]] + + + + + + + + + + + + + diff --git a/addons/account/report/wizard_central_journal.rml b/addons/account/report/wizard_central_journal.rml index c61f5fafc56..1a8d9b62187 100644 --- a/addons/account/report/wizard_central_journal.rml +++ b/addons/account/report/wizard_central_journal.rml @@ -34,6 +34,10 @@ + + + + @@ -51,6 +55,13 @@ + + + + + + + @@ -65,6 +76,13 @@ + + + + + + + @@ -143,13 +161,22 @@ + + + + Central Journal + + + - + [[ repeatIn(lines(data['form']['periods'],data['form']['journal_ids']), 'line') ]] + Start Period + End Period Journal Code @@ -161,16 +188,18 @@ - + + [[ get_start_date(data['form']) ]] + [[ get_end_date(data['form']) ]] - [[ line[0]['journal'].code or '' ]] + [[ line[0]['journal'].code or '' ]] - [[ line[0]['journal'].name ]] + [[ line[0]['journal'].name ]] - [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time = True) ]] + [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time = True) ]] diff --git a/addons/account/report/wizard_general_journal.rml b/addons/account/report/wizard_general_journal.rml index cf0d058147f..d436ae87bed 100644 --- a/addons/account/report/wizard_general_journal.rml +++ b/addons/account/report/wizard_general_journal.rml @@ -38,6 +38,10 @@ + + + + @@ -66,6 +70,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -124,24 +156,40 @@ - + - Printing Date : - - - [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time = True) ]] + General Journal - + + + + - + + + Start Period + End Period + Printing Date + + + + + [[ get_start_date(data['form']) ]] + [[ get_end_date(data['form']) ]] + [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time = True) ]] + + + - +
- + + + diff --git a/addons/account/wizard/account_partner_balance_report.py b/addons/account/wizard/account_partner_balance_report.py index c6d82128256..2b4730a09e4 100644 --- a/addons/account/wizard/account_partner_balance_report.py +++ b/addons/account/wizard/account_partner_balance_report.py @@ -40,7 +40,7 @@ class account_partner_balance(osv.osv_memory): 'periods': fields.many2many('account.period', 'period_report_rel', 'report_id', 'period_id', 'Periods', help='All periods if empty'), 'result_selection': fields.selection([('customer','Receivable Accounts'), ('supplier','Payable Accounts'), - ('all','Receivable and Payable Accounts')], + ('Suppliers and Customers' ,'Receivable and Payable Accounts')], 'Partner', required=True), 'soldeinit': fields.boolean('Include initial balances'), 'date1': fields.date('Start date', required=True), @@ -60,7 +60,7 @@ class account_partner_balance(osv.osv_memory): 'state' : 'none', 'date1' : time.strftime('%Y-01-01'), 'date2' : time.strftime('%Y-%m-%d'), - 'result_selection' : 'all', + 'result_selection' : 'Suppliers and Customers', 'soldeinit' : True, 'company_id' : _get_company, 'fiscalyear' : False,