[FIX] account: incorrect usage of browse_record in fix for accounting reports merged...
authorOlivier Dony <odo@openerp.com>
Mon, 12 Nov 2012 16:47:33 +0000 (17:47 +0100)
committerOlivier Dony <odo@openerp.com>
Mon, 12 Nov 2012 16:47:33 +0000 (17:47 +0100)
The browse_record was being passed instead of its ID in the
search domain. Also cleaned up the useless `for` loop.

bzr revid: odo@openerp.com-20121112164733-n2uafcrfgux1awl8

addons/account/wizard/account_report_common.py

index eea0650..4438484 100644 (file)
@@ -119,11 +119,11 @@ class account_common_report(osv.osv_memory):
 
     def _get_fiscalyear(self, cr, uid, context=None):
         now = time.strftime('%Y-%m-%d')
-        company_id = None
+        company_id = False
         ids = context.get('active_ids', [])
-        for wiz in self.browse(cr, uid, ids, context=context):
-            company_id = wiz.company_id
-        fiscalyears = self.pool.get('account.fiscalyear').search(cr, uid, [('date_start', '<', now), ('date_stop', '>', now), ('company_id', '=', company_id)], limit=1 )
+        if ids:
+            company_id = self.browse(cr, uid, ids[0], context=context).company_id.id
+        fiscalyears = self.pool.get('account.fiscalyear').search(cr, uid, [('date_start', '<', now), ('date_stop', '>', now), ('company_id', '=', company_id)], limit=1)
         return fiscalyears and fiscalyears[0] or False
 
     def _get_all_journal(self, cr, uid, context=None):