[IMP] account: more refactoring on wizards (filter on journal)
authorqdp-launchpad@tinyerp.com <>
Tue, 6 Jul 2010 12:13:44 +0000 (14:13 +0200)
committerqdp-launchpad@tinyerp.com <>
Tue, 6 Jul 2010 12:13:44 +0000 (14:13 +0200)
bzr revid: qdp-launchpad@tinyerp.com-20100706121344-slqpt2hau5tngm7s

addons/account/account_move_line.py
addons/account/wizard/account_balance_report.py
addons/account/wizard/account_common_report.py

index 2844ed4..341d5f9 100644 (file)
@@ -62,6 +62,9 @@ class account_move_line(osv.osv):
         else:
             query = obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) %s %s)" % (fiscalyear_clause,where_move_state,where_move_lines_by_date)
 
+        if context.get('journal_ids', False):
+            query += ' AND '+obj+'.journal_id in (%s)' % ','.join(map(str, context['journal_ids']))
+
         if context.get('period_manner','') == 'created':
             #the query have to be build with no reference to periods but thanks to the creation date
             if context.get('periods',False):
index bf0b264..5b6e3ed 100644 (file)
@@ -59,7 +59,7 @@ class account_balance_report(osv.osv_memory):
 
     def _print_report(self, cr, uid, ids, data, query_line, context=None):
         data['form'].update(self.read(cr, uid, ids, ['display_account',])[0])
-        data['form']['query_line'] = query_line + ' AND l.journal_id in (%s)' % ','.join(map(str, data['form']['journal_ids']))
+        data['form']['query_line'] = query_line
         return { 'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance', 'datas': data, 'nodestroy':True, }
 
 account_balance_report()
index 5418730..ec568f5 100644 (file)
@@ -88,7 +88,8 @@ class account_common_report(osv.osv_memory):
             context = {}
         result = {}
         period_obj = self.pool.get('account.period')
-        result['fiscalyear'] = data['form']['fiscalyear_id'] and data['form']['fiscalyear_id'] or False
+        result['fiscalyear'] = 'fiscalyear_id' in data['form'] and data['form']['fiscalyear_id'] or False
+        result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False
         if data['form']['filter'] == 'filter_date':
             result['date_from'] = data['form']['date_from']
             result['date_to'] = data['form']['date_to']