Merge lp:~camptocamp/ocb-addons/7.0-fix-report-inactive-journals-mdh into lp:ocb-addons

Proposed by Matthieu Dietrich @ camptocamp
Status: Rejected
Rejected by: Leonardo Pistone
Proposed branch: lp:~camptocamp/ocb-addons/7.0-fix-report-inactive-journals-mdh
Merge into: lp:ocb-addons
Diff against target: 36 lines (+17/-2)
1 file modified
account/wizard/account_report_common.py (+17/-2)
To merge this branch: bzr merge lp:~camptocamp/ocb-addons/7.0-fix-report-inactive-journals-mdh
Reviewer Review Type Date Requested Status
Leonardo Pistone Disapprove
Frederic Clementi - Camptocamp Pending
Review via email: mp+232175@code.launchpad.net

Commit message

[FIX] reports now search for inactive journals by default

Description of the change

A fix after the change in https://code.launchpad.net/~camptocamp/ocb-addons/7.0-fix-bug-1180803 : since the default journals used in reports were searched without a context, that meant that entries on inactive journals were not used in the report (except General Ledger, which didn't have a default value and thus got all entries).

This fix adds the variable {'active_test': False} as the context for both the search and the read.

Regards,
Matthieu Dietrich

To post a comment you must log in.
Revision history for this message
Leonardo Pistone (lepistone) wrote :

Hi, OCB is now on github. Thanks!

review: Disapprove

Unmerged revisions

10226. By Matthieu Dietrich @ camptocamp on 2014-08-26

[FIX] reports now use entries in inactive journals

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/wizard/account_report_common.py'
2--- account/wizard/account_report_common.py 2014-03-10 08:54:20 +0000
3+++ account/wizard/account_report_common.py 2014-08-26 08:31:01 +0000
4@@ -136,7 +136,12 @@
5 return fiscalyears and fiscalyears[0] or False
6
7 def _get_all_journal(self, cr, uid, context=None):
8- return self.pool.get('account.journal').search(cr, uid ,[])
9+ # The 'active_test' context is used, because reports must
10+ # return entries created on inactive journals.
11+ return self.pool.get('account.journal').search(cr, uid, [],
12+ context={
13+ 'active_test': False
14+ })
15
16 _defaults = {
17 'fiscalyear_id': _get_fiscalyear,
18@@ -174,7 +179,17 @@
19 data = {}
20 data['ids'] = context.get('active_ids', [])
21 data['model'] = context.get('active_model', 'ir.ui.menu')
22- data['form'] = self.read(cr, uid, ids, ['date_from', 'date_to', 'fiscalyear_id', 'journal_ids', 'period_from', 'period_to', 'filter', 'chart_account_id', 'target_move'], context=context)[0]
23+ data['form'] = self.read(cr, uid, ids, ['date_from', 'date_to',
24+ 'fiscalyear_id', 'period_from',
25+ 'period_to', 'filter',
26+ 'chart_account_id',
27+ 'target_move'])[0]
28+ # The 'active_test' context is used, because reports must
29+ # return entries created on inactive journals.
30+ data['form']['journal_ids'] = self.read(cr, uid, ids, ['journal_ids'],
31+ context={
32+ 'active_test': False
33+ })[0]['journal_ids']
34 for field in ['fiscalyear_id', 'chart_account_id', 'period_from', 'period_to']:
35 if isinstance(data['form'][field], tuple):
36 data['form'][field] = data['form'][field][0]