From 20a460847d374c08e803f2ee2a2de6097c948691 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Tue, 3 Aug 2010 14:46:55 +0530 Subject: [PATCH] [FIX] general jornals bzr revid: mra@mra-laptop-20100803091655-i90l4856eda8uoqt --- .../account/report/account_general_journal.py | 12 +++- .../report/account_general_journal.rml | 60 +++++++++---------- addons/account/report/account_journal.py | 8 ++- addons/account/report/account_journal.rml | 40 ++++++------- 4 files changed, 65 insertions(+), 55 deletions(-) diff --git a/addons/account/report/account_general_journal.py b/addons/account/report/account_general_journal.py index e76ffdf562c..d5e73fd2d42 100644 --- a/addons/account/report/account_general_journal.py +++ b/addons/account/report/account_general_journal.py @@ -116,8 +116,11 @@ class journal_print(report_sxw.rml_parse, common_report_header): return True return data['form']['amount_currency'] - def _sum_debit_period(self, period_id, journal_id=None): - journals = journal_id or self.journal_ids + def _sum_debit_period(self, period_id, journal_id=False): + if journal_id: + journals = [journal_id] + else: + journals = self.journal_ids if not journals: return 0.0 self.cr.execute('SELECT SUM(debit) FROM account_move_line ' @@ -127,7 +130,10 @@ class journal_print(report_sxw.rml_parse, common_report_header): return self.cr.fetchone()[0] or 0.0 def _sum_credit_period(self, period_id, journal_id=None): - journals = journal_id or self.journal_ids + if journal_id: + journals = [journal_id] + else: + journals = self.journal_ids if not journals: return 0.0 self.cr.execute('SELECT SUM(credit) FROM account_move_line ' diff --git a/addons/account/report/account_general_journal.rml b/addons/account/report/account_general_journal.rml index 75c6e443983..6a6c719dd27 100644 --- a/addons/account/report/account_general_journal.rml +++ b/addons/account/report/account_general_journal.rml @@ -4,8 +4,8 @@ - - + + @@ -113,8 +113,8 @@ - - + + @@ -154,7 +154,7 @@ - + @@ -201,7 +201,7 @@ - [[ repeatIn( periods(objects), 'o') ]] + [[ repeatIn( periods(objects), 'o') ]] @@ -224,38 +224,38 @@ - Company [[ data['model']=='account.journal.period' or removeParentNode('para') ]] + Company [[ data['model']=='account.journal.period' or removeParentNode('para') ]] Chart of Account [[ data['model']=='ir.ui.menu' or removeParentNode('para') ]] Fiscal Year - Journals + Journals Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] Printing Date [[ get_account(data) or removeParentNode('para') ]] [[ get_fiscalyear(data) or '' ]] - [[', '.join([ lt or '' for lt in get_journal(data) ]) ]] + [[', '.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 - + End Date + [[ get_start_date(data)]] - [[get_end_date(data) ]] + [[get_end_date(data) ]] [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] Start Period - End 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) ]] @@ -270,14 +270,14 @@ Journal Name Debit Credit - Balance + Balance Total: [[ formatLang(sum_debit()) ]] [[ formatLang( sum_credit()) ]] - [[ formatLang( sum_debit()- sum_credit()) ]] + [[ formatLang( sum_debit()- sum_credit()) ]] [[ display_currency(data) or removeParentNode('blockTable') ]] @@ -286,7 +286,7 @@ Journal Name Debit Credit - Balance + Balance Currency @@ -294,10 +294,10 @@ [[ formatLang(sum_debit()) ]] [[ formatLang( sum_credit()) ]] - [[ formatLang( sum_credit()- sum_debit()) ]] + [[ formatLang( sum_credit()- sum_debit()) ]] - - + +
[[ display_currency(data) or removeParentNode('blockTable') ]] @@ -309,22 +309,22 @@ - [[ formatLang(sum_debit_period(o.id)) ]] + [[ formatLang(sum_debit_period(o.period_id.id, o.journal_id.id)) ]] - [[ formatLang(sum_credit_period(o.id)) ]] + [[ formatLang(sum_credit_period(o.period_id.id, o.journal_id.id)) ]] - [[ formatLang(sum_credit_period(o.id)-sum_debit_period(o.id)) ]] + [[ formatLang(sum_credit_period(o.id, o.journal_id.id)-sum_debit_period(o.id, o.journal_id.id)) ]] - + - + [[ display_currency(data)==False or removeParentNode('blockTable') ]] @@ -344,7 +344,7 @@ [[ formatLang(sum_credit_period(o.id)-sum_debit_period(o.id)) ]] - + [[ display_currency(data) == False or removeParentNode('blockTable') ]] @@ -361,7 +361,7 @@ [[ formatLang(line['credit']-line['debit'] ) ]] - + [[ display_currency(data) or removeParentNode('blockTable') ]] @@ -370,8 +370,8 @@ [[ line['name'] ]] [[ formatLang(line['debit'] )]] [[ formatLang(line['credit']) ]] - [[ formatLang(line['credit']-line['debit'] ) ]] - [[ line['currency_id'] and formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]] + [[ formatLang(line['credit']-line['debit'] ) ]] + [[ line['currency_id'] and formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]] diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index d4187ad6090..1ed15f60b6f 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -66,11 +66,15 @@ class journal_print(report_sxw.rml_parse, common_report_header): self.period_ids, self.journal_ids = zip(*res) return super(journal_print, self).set_context(objects, data, ids, report_type=report_type) - def lines(self, period_id): + def lines(self, period_id, journal_id=False): + if not journal_id: + journal_id = self.journal_ids + else: + journal_id = [journal_id] obj_mline = self.pool.get('account.move.line') self.cr.execute('update account_journal_period set state=%s where journal_id IN %s and period_id=%s and state=%s', ('printed', self.journal_ids, period_id, 'draft')) self.cr.commit() - self.cr.execute('SELECT id FROM account_move_line l WHERE period_id=%s AND journal_id IN %s ' + self.query_get_clause + ' ORDER BY '+ self.sort_selection + '' ,(period_id, self.journal_ids )) + self.cr.execute('SELECT id FROM account_move_line l WHERE period_id=%s AND journal_id IN %s ' + self.query_get_clause + ' ORDER BY '+ self.sort_selection + '' ,(period_id, tuple(journal_id) )) ids = map(lambda x: x[0], self.cr.fetchall()) return obj_mline.browse(self.cr, self.uid, ids) diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml index efba78ca73d..d857d72e98e 100644 --- a/addons/account/report/account_journal.rml +++ b/addons/account/report/account_journal.rml @@ -56,7 +56,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -179,7 +179,7 @@ - + @@ -205,10 +205,10 @@ - Company [[ data['model']=='account.journal.period' or removeParentNode('para') ]] + Company [[ data['model']=='account.journal.period' or removeParentNode('para') ]] Chart of Account [[ data['model']=='ir.ui.menu' or removeParentNode('para') ]] Fiscal Year - Journal + Journal Filters By Entries Sorted By Printing Date @@ -221,23 +221,23 @@ [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] Start Date - End Date - + End Date + [[ get_start_date(data) ]] - [[ get_end_date(data) ]] + [[ get_end_date(data) ]] [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] Start Period - End Period - + End Period + [[ get_start_period(data) or removeParentNode('para') ]] [[ get_end_period(data) or removeParentNode('para') ]] - + [[ get_sortby(data) ]] [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] @@ -271,7 +271,7 @@ [[ formatLang((sum_credit(o.period_id.id, o.journal_id.id) - sum_debit(o.period_id.id, o.journal_id.id))) ]] - [[ repeatIn(lines(o.period_id.id), 'line') ]][[ formatLang(line.date,date=True) ]] + [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line.date,date=True) ]] [[ line.ref ]] [[ line.account_id.code ]] [[ line.partner_id and line.partner_id.name ]] @@ -281,8 +281,8 @@ [[ formatLang(line.credit - line.debit) ]] - - + + [[ display_currency(data) or removeParentNode('blockTable') ]] Date @@ -292,8 +292,8 @@ Entry label Debit Credit - Balance - Currency + Balance + Currency [[o.period_id.name ]] @@ -306,7 +306,7 @@ [[ formatLang((sum_debit(o.period_id.id, o.journal_id.id) - sum_credit(o.period_id.id, o.journal_id.id))) ]] - [[ repeatIn(lines(o.period_id.id), 'line') ]][[ formatLang(line.date,date=True) ]] + [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line.date,date=True) ]] [[ line.ref ]] [[ line.account_id.code ]] [[ line.partner_id and line.partner_id.name ]] @@ -314,9 +314,9 @@ [[ formatLang(line.debit) ]] [[ formatLang(line.credit) ]] [[ formatLang(line.credit - line.debit) ]] - [[ line.currency_id and formatLang(line.amount_currency) or '' ]] [[ line.currency_id.code or '']] - + [[ line.currency_id and formatLang(line.amount_currency) or '' ]] [[ line.currency_id.code or '']] + - +