openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #07918
[Merge] lp:~camptocamp/ocb-addons/7.0-fix-report-inactive-journals-mdh into lp:ocb-addons
Matthieu Dietrich @ camptocamp has proposed merging lp:~camptocamp/ocb-addons/7.0-fix-report-inactive-journals-mdh into lp:ocb-addons.
Commit message:
[FIX] reports now search for inactive journals by default
Requested reviews:
Frederic Clementi - Camptocamp (frederic-clementi)
For more details, see:
https://code.launchpad.net/~camptocamp/ocb-addons/7.0-fix-report-inactive-journals-mdh/+merge/232175
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
--
https://code.launchpad.net/~camptocamp/ocb-addons/7.0-fix-report-inactive-journals-mdh/+merge/232175
Your team OpenERP Community Backports is subscribed to branch lp:ocb-addons.
=== modified file 'account/wizard/account_report_common.py'
--- account/wizard/account_report_common.py 2014-03-10 08:54:20 +0000
+++ account/wizard/account_report_common.py 2014-08-26 08:31:01 +0000
@@ -136,7 +136,12 @@
return fiscalyears and fiscalyears[0] or False
def _get_all_journal(self, cr, uid, context=None):
- return self.pool.get('account.journal').search(cr, uid ,[])
+ # The 'active_test' context is used, because reports must
+ # return entries created on inactive journals.
+ return self.pool.get('account.journal').search(cr, uid, [],
+ context={
+ 'active_test': False
+ })
_defaults = {
'fiscalyear_id': _get_fiscalyear,
@@ -174,7 +179,17 @@
data = {}
data['ids'] = context.get('active_ids', [])
data['model'] = context.get('active_model', 'ir.ui.menu')
- 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]
+ data['form'] = self.read(cr, uid, ids, ['date_from', 'date_to',
+ 'fiscalyear_id', 'period_from',
+ 'period_to', 'filter',
+ 'chart_account_id',
+ 'target_move'])[0]
+ # The 'active_test' context is used, because reports must
+ # return entries created on inactive journals.
+ data['form']['journal_ids'] = self.read(cr, uid, ids, ['journal_ids'],
+ context={
+ 'active_test': False
+ })[0]['journal_ids']
for field in ['fiscalyear_id', 'chart_account_id', 'period_from', 'period_to']:
if isinstance(data['form'][field], tuple):
data['form'][field] = data['form'][field][0]
Follow ups