fixes #36 - v8 account_financial_report_webkit error when print journal

pull/49/head
ccarly 2015-01-12 20:22:06 -05:00
parent 27b87b5618
commit 8dad0e5f55
2 changed files with 7 additions and 5 deletions

View File

@ -126,8 +126,9 @@ class PrintJournalWebkit(report_sxw.rml_parse, CommonReportHeaderWebkit):
objects = account_journal_period_obj.browse(self.cursor, self.uid, objects = account_journal_period_obj.browse(self.cursor, self.uid,
new_ids) new_ids)
# Sort by journal and period # Sort by journal and period
objects.sort(key=lambda a: (a.journal_id.code, a.period_id.date_start)) objects.sorted(key=lambda a: (a.journal_id.code, a.period_id.date_start))
move_obj = self.pool.get('account.move') move_obj = self.pool.get('account.move')
moves = {}
for journal_period in objects: for journal_period in objects:
domain_arg = [ domain_arg = [
('journal_id', '=', journal_period.journal_id.id), ('journal_id', '=', journal_period.journal_id.id),
@ -137,11 +138,11 @@ class PrintJournalWebkit(report_sxw.rml_parse, CommonReportHeaderWebkit):
domain_arg += [('state', '=', 'posted')] domain_arg += [('state', '=', 'posted')]
move_ids = move_obj.search(self.cursor, self.uid, domain_arg, move_ids = move_obj.search(self.cursor, self.uid, domain_arg,
order="name") order="name")
journal_period.moves = move_obj.browse(self.cursor, self.uid, moves[journal_period..id] = move_obj.browse(self.cursor, self.uid,
move_ids) move_ids)
# Sort account move line by account accountant # Sort account move line by account accountant
for move in journal_period.moves: for move in moves[journal_period..id]:
move.line_id.sort(key=lambda a: (a.date, a.account_id.code)) move.line_id.sorted(key=lambda a: (a.date, a.account_id.code))
self.localcontext.update({ self.localcontext.update({
'fiscalyear': fiscalyear, 'fiscalyear': fiscalyear,
@ -150,6 +151,7 @@ class PrintJournalWebkit(report_sxw.rml_parse, CommonReportHeaderWebkit):
'start_period': start_period, 'start_period': start_period,
'stop_period': stop_period, 'stop_period': stop_period,
'chart_account': chart_account, 'chart_account': chart_account,
'moves', moves,
}) })
return super(PrintJournalWebkit, self).set_context( return super(PrintJournalWebkit, self).set_context(

View File

@ -99,7 +99,7 @@
%endif %endif
</div> </div>
</div> </div>
%for move in journal_period.moves: %for move in moves[journal_period.id]:
<% <%
new_move = True new_move = True
%> %>