From 7385106b97ee588439cc04d93d22c81a0021f1c1 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 6 Feb 2012 11:27:00 +0100 Subject: [PATCH] [FIX] account, print journal reports: fixed active_ids and blank lines at the beginning of each report bzr revid: qdp-launchpad@openerp.com-20120206102700-egpw5evtssnke54u --- addons/account/report/account_journal.py | 5 ++++- addons/account/report/account_journal.rml | 2 +- addons/account/report/account_journal_sale_purchase.rml | 2 +- addons/account/wizard/account_report_common_journal.py | 7 +++++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 2e0a031..2669a3d 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -60,12 +60,15 @@ class journal_print(report_sxw.rml_parse, common_report_header): self.query_get_clause = '' self.target_move = data['form'].get('target_move', 'all') if (data['model'] == 'ir.ui.menu'): + self.period_ids = tuple(data['form']['periods']) + self.journal_ids = tuple(data['form']['journal_ids']) new_ids = data['form'].get('active_ids', []) self.query_get_clause = 'AND ' self.query_get_clause += obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {})) self.sort_selection = data['form'].get('sort_selection', 'date') objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids) - if new_ids: + elif new_ids: + #in case of direct access from account.journal.period object, we need to set the journal_ids and periods_ids self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),)) res = self.cr.fetchall() self.period_ids, self.journal_ids = zip(*res) diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml index acc11ac..c7353da 100644 --- a/addons/account/report/account_journal.rml +++ b/addons/account/report/account_journal.rml @@ -209,7 +209,7 @@ - [[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]][[ set_last_move_id(False)]] + [[ set_last_move_id(False)]]
[[ display_currency(data) == False or removeParentNode('section') ]] diff --git a/addons/account/report/account_journal_sale_purchase.rml b/addons/account/report/account_journal_sale_purchase.rml index fc42bb0..453968c 100644 --- a/addons/account/report/account_journal_sale_purchase.rml +++ b/addons/account/report/account_journal_sale_purchase.rml @@ -209,7 +209,7 @@ - [[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]][[ set_last_move_id(False)]] + [[ set_last_move_id(False) ]]
[[ display_currency(data) == False or removeParentNode('section') ]] diff --git a/addons/account/wizard/account_report_common_journal.py b/addons/account/wizard/account_report_common_journal.py index e71d380..92076cf 100644 --- a/addons/account/wizard/account_report_common_journal.py +++ b/addons/account/wizard/account_report_common_journal.py @@ -29,13 +29,16 @@ class account_common_journal_report(osv.osv_memory): 'amount_currency': fields.boolean("With Currency", help="Print Report with the currency column if the currency is different then the company currency"), } - def _build_context(self, cr, uid, ids, data, context=None): + def _build_contexts(self, cr, uid, ids, data, context=None): if context is None: context = {} - result = super(account_common_journal_report, self)._build_context(cr, uid, ids, data, context=context) + result = super(account_common_journal_report, self)._build_contexts(cr, uid, ids, data, context=context) + if data['form']['filter'] == 'filter_date': cr.execute('SELECT period_id FROM account_move_line WHERE date >= %s AND date <= %s', (data['form']['date_from'], data['form']['date_to'])) result['periods'] = map(lambda x: x[0], cr.fetchall()) + elif data['form']['filter'] == 'filter_period': + result['periods'] = self.pool.get('account.period').build_ctx_periods(cr, uid, data['form']['period_from'], data['form']['period_to']) return result def pre_print_report(self, cr, uid, ids, data, context=None): -- 1.7.10.4