From 49ad2f0f510451eb416f9245d2fb16a73a688e2e Mon Sep 17 00:00:00 2001 From: Chris Biersbach Date: Thu, 13 Sep 2012 09:09:52 +0200 Subject: [PATCH] [FIX] Reports (Balance Sheet, P&L,...) for consolidated companies can now correctly be generated bzr revid: cbi@openerp.com-20120913070952-zlk7q9l53tc3r3su --- addons/account/account.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 72ce11f05ea..b23ac2d0ee1 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1095,10 +1095,14 @@ class account_period(osv.osv): raise osv.except_osv(_('Error'), _('You should have chosen periods that belongs to the same company')) if period_date_start > period_date_stop: raise osv.except_osv(_('Error'), _('Start period should be smaller then End period')) - #for period from = january, we want to exclude the opening period (but it has same date_from, so we have to check if period_from is special or not to include that clause or not in the search). + + # /!\ We do not include a criterion on the company_id field below, to allow producing consolidated reports + # on multiple companies. It will only work when start/end periods are selected and no fiscal year is chosen. + + # for period from = january, we want to exclude the opening period (but it has same date_from, so we have to check if period_from is special or not to include that clause or not in the search). if period_from.special: - return self.search(cr, uid, [('date_start', '>=', period_date_start), ('date_stop', '<=', period_date_stop), ('company_id', '=', company1_id)]) - return self.search(cr, uid, [('date_start', '>=', period_date_start), ('date_stop', '<=', period_date_stop), ('company_id', '=', company1_id), ('special', '=', False)]) + return self.search(cr, uid, [('date_start', '>=', period_date_start), ('date_stop', '<=', period_date_stop)]) + return self.search(cr, uid, [('date_start', '>=', period_date_start), ('date_stop', '<=', period_date_stop), ('special', '=', False)]) account_period()