Somesh Khare has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-19966-skh into 
lp:openobject-addons/6.0.

Requested reviews:
  Vo Minh Thu (OpenERP) (vmt-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-19966-skh/+merge/80991

Hello VMT,

[Fix] :  Account : accounting dashboard uses wrong logic, current year is used 
where correct values are given by using the open fiscal years.

According to the OPW issue: 19966, In the Accounting Dashboard: When you open 
the Dashboard It uses the current year.

Kindly review and please share your view on it.


Thanks
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-19966-skh/+merge/80991
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-19966-skh.
=== modified file 'account/board_account_view.xml'
--- account/board_account_view.xml	2011-06-24 09:07:48 +0000
+++ account/board_account_view.xml	2011-11-02 09:08:04 +0000
@@ -28,7 +28,7 @@
 			<field name="view_mode">tree,graph</field>
 			<field name="context">{'group_by':['user_type'], 'group_by_no_leaf':1}</field>
 			<field name="view_id" ref="account.view_account_entries_report_tree"/>
-			<field name="domain">[('year','=',time.strftime('%Y'))]</field>
+			<field name="domain">[('fiscalyear_id','in','open_years')]</field>
 		</record>
 		
 		<record id="action_treasory_graph" model="ir.actions.act_window">

=== modified file 'account/report/account_entries_report.py'
--- account/report/account_entries_report.py	2011-01-14 00:11:01 +0000
+++ account/report/account_entries_report.py	2011-11-02 09:08:04 +0000
@@ -88,6 +88,13 @@
                 current_year = fiscalyear_obj.find(cr, uid)
                 ids = fiscalyear_obj.read(cr, uid, [current_year], ['period_ids'])[0]['period_ids']
                 args.append(['period_id','in',ids])
+            elif arg[0] == 'fiscalyear_id' and arg[2] == 'open_years':
+                current_year = fiscalyear_obj.find(cr, uid)
+                fy_date_start = fiscalyear_obj.browse(cr, uid, current_year).date_start
+                fy_ids = fiscalyear_obj.search(cr, uid, [('date_stop', '<=', fy_date_start), ('state', '=', 'draft')])
+                fy_open_ids = fy_ids + [current_year]
+                i = args.index(arg)
+                args[i] = ('period_id','in',fy_open_ids)  
         for a in [['period_id','in','current_year'], ['period_id','in','current_period']]:
             if a in args:
                 args.remove(a)
@@ -99,6 +106,14 @@
             context = {}
         fiscalyear_obj = self.pool.get('account.fiscalyear')
         period_obj = self.pool.get('account.period')
+        for arg in domain:
+            if arg[0] == 'fiscalyear_id' and arg[2] == 'open_years':
+                current_year = fiscalyear_obj.find(cr, uid)
+                fy_date_start = fiscalyear_obj.browse(cr, uid, current_year).date_start
+                fy_ids = fiscalyear_obj.search(cr, uid, [('date_stop', '<=', fy_date_start), ('state', '=', 'draft')])
+                fy_open_ids = fy_ids + [current_year]
+                i = domain.index(arg)
+                domain[i] = ('fiscalyear_id','in',fy_open_ids)   
         if context.get('period', False) == 'current_period':
             current_period = period_obj.find(cr, uid)[0]
             domain.append(['period_id','in',[current_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