also consider entries on inactive journals for the general ledger report
authorMatthieu Dietrich <matthieu.dietrich@camptocamp.com>
Tue, 30 Sep 2014 12:14:56 +0000 (14:14 +0200)
committerMatthieu Dietrich <matthieu.dietrich@camptocamp.com>
Tue, 30 Sep 2014 12:14:56 +0000 (14:14 +0200)
addons/account/wizard/account_report_common.py

index bbef144..fcbf87d 100644 (file)
@@ -136,7 +136,12 @@ class account_common_report(osv.osv_memory):
         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 @@ class account_common_report(osv.osv_memory):
         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]