Merge lp:~openerp-dev/openobject-addons/6.0-opw-19966-skh into lp:openobject-addons/6.0

Proposed by Somesh Khare
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-19966-skh
Merge into: lp:openobject-addons/6.0
Diff against target: 45 lines (+16/-1)
2 files modified
account/board_account_view.xml (+1/-1)
account/report/account_entries_report.py (+15/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-19966-skh
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Vo Minh Thu Pending
Review via email: mp+80991@code.launchpad.net

Description of the change

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

To post a comment you must log in.

Unmerged revisions

4904. By Luc De Meyer(Noviat)

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/board_account_view.xml'
2--- account/board_account_view.xml 2011-06-24 09:07:48 +0000
3+++ account/board_account_view.xml 2011-11-02 09:08:04 +0000
4@@ -28,7 +28,7 @@
5 <field name="view_mode">tree,graph</field>
6 <field name="context">{'group_by':['user_type'], 'group_by_no_leaf':1}</field>
7 <field name="view_id" ref="account.view_account_entries_report_tree"/>
8- <field name="domain">[('year','=',time.strftime('%Y'))]</field>
9+ <field name="domain">[('fiscalyear_id','in','open_years')]</field>
10 </record>
11
12 <record id="action_treasory_graph" model="ir.actions.act_window">
13
14=== modified file 'account/report/account_entries_report.py'
15--- account/report/account_entries_report.py 2011-01-14 00:11:01 +0000
16+++ account/report/account_entries_report.py 2011-11-02 09:08:04 +0000
17@@ -88,6 +88,13 @@
18 current_year = fiscalyear_obj.find(cr, uid)
19 ids = fiscalyear_obj.read(cr, uid, [current_year], ['period_ids'])[0]['period_ids']
20 args.append(['period_id','in',ids])
21+ elif arg[0] == 'fiscalyear_id' and arg[2] == 'open_years':
22+ current_year = fiscalyear_obj.find(cr, uid)
23+ fy_date_start = fiscalyear_obj.browse(cr, uid, current_year).date_start
24+ fy_ids = fiscalyear_obj.search(cr, uid, [('date_stop', '<=', fy_date_start), ('state', '=', 'draft')])
25+ fy_open_ids = fy_ids + [current_year]
26+ i = args.index(arg)
27+ args[i] = ('period_id','in',fy_open_ids)
28 for a in [['period_id','in','current_year'], ['period_id','in','current_period']]:
29 if a in args:
30 args.remove(a)
31@@ -99,6 +106,14 @@
32 context = {}
33 fiscalyear_obj = self.pool.get('account.fiscalyear')
34 period_obj = self.pool.get('account.period')
35+ for arg in domain:
36+ if arg[0] == 'fiscalyear_id' and arg[2] == 'open_years':
37+ current_year = fiscalyear_obj.find(cr, uid)
38+ fy_date_start = fiscalyear_obj.browse(cr, uid, current_year).date_start
39+ fy_ids = fiscalyear_obj.search(cr, uid, [('date_stop', '<=', fy_date_start), ('state', '=', 'draft')])
40+ fy_open_ids = fy_ids + [current_year]
41+ i = domain.index(arg)
42+ domain[i] = ('fiscalyear_id','in',fy_open_ids)
43 if context.get('period', False) == 'current_period':
44 current_period = period_obj.find(cr, uid)[0]
45 domain.append(['period_id','in',[current_period]])