Browse Source

Merge pull request #49 from fonse-sas/8.0

fixes #36 - v8 account_financial_report_webkit error when print journal
pull/50/head
Pedro M. Baeza 10 years ago
parent
commit
7a5bb94b5f
  1. 10
      account_financial_report_webkit/report/print_journal.py
  2. 2
      account_financial_report_webkit/report/templates/account_report_print_journal.mako

10
account_financial_report_webkit/report/print_journal.py

@ -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:
move.line_id.sort(key=lambda a: (a.date, a.account_id.code))
for move in moves[journal_period.id]:
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(

2
account_financial_report_webkit/report/templates/account_report_print_journal.mako

@ -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
%> %>

Loading…
Cancel
Save