Chris Biersbach (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-577644-cbi into 
lp:openobject-addons/6.1.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-577644-cbi/+merge/124109

It was not possible to generate accounting reports such as balance sheet and 
P&L for consolidated companies since their fiscal years and periods differ.

This fix gives the possibility to generate these reports by specifying 
end/start period (before it was only possible when specifying end/start date)

This works under the following conditions:

 1. clear the fiscal year on the report wizard before printing, to explicitly 
allow cross-company reporting
 2. choose a start/end period filter, or a start/end date filter
 3. execute the report with a user that is allowed to see all consolidated 
companies and their fiscal years/periods

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-577644-cbi/+merge/124109
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-577644-cbi.
=== modified file 'account/account.py'
--- account/account.py	2012-08-28 07:48:35 +0000
+++ account/account.py	2012-09-13 07:14:19 +0000
@@ -1095,10 +1095,14 @@
             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()
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to