Merge lp:~openerp-dev/openobject-addons/6.1-fields_view_get-fixes-xmo into lp:openobject-addons/6.1

Proposed by Xavier (Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-fields_view_get-fixes-xmo
Merge into: lp:openobject-addons/6.1
Diff against target: 51 lines (+4/-4)
4 files modified
account/wizard/account_move_journal.py (+1/-1)
auction/wizard/auction_lots_buyer_map.py (+1/-1)
mrp_repair/wizard/cancel_repair.py (+1/-1)
project_gtd/project_gtd.py (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-fields_view_get-fixes-xmo
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+94369@code.launchpad.net

Description of the change

After fixing this issue in trunk, I checked addons and found a few which override fields_view_get and unconditionally return form views, even if the client asked for a list or search view.

This is nonsensical behavior, this proposal mostly adds guards where it seemed to make sense, in order to prevent blowing up non-form view by replacing them with form views.

(it also removes an unneeded default provided to a `dict.get` in a fields_view_get)

To post a comment you must log in.

Unmerged revisions

6631. By Xavier (Open ERP)

[FIX] account, auction, mrp_repair: fields_view_get overrides outputting form views even when asked for other view types

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/wizard/account_move_journal.py'
2--- account/wizard/account_move_journal.py 2011-11-14 11:34:05 +0000
3+++ account/wizard/account_move_journal.py 2012-02-23 13:24:50 +0000
4@@ -80,7 +80,7 @@
5
6 res = super(account_move_journal, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
7
8- if not view_id:
9+ if view_type != 'form' or not view_id:
10 return res
11
12 period_pool = self.pool.get('account.period')
13
14=== modified file 'auction/wizard/auction_lots_buyer_map.py'
15--- auction/wizard/auction_lots_buyer_map.py 2011-01-14 00:11:01 +0000
16+++ auction/wizard/auction_lots_buyer_map.py 2012-02-23 13:24:50 +0000
17@@ -106,7 +106,7 @@
18 context={}
19 record_ids = context and context.get('active_ids', []) or []
20 res = super(wiz_auc_lots_buyer_map, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
21- if context.get('active_model','') != 'auction.lots':
22+ if view_type != 'form' or context.get('active_model','') != 'auction.lots':
23 return res
24 lots_obj = self.pool.get('auction.lots')
25 if record_ids:
26
27=== modified file 'mrp_repair/wizard/cancel_repair.py'
28--- mrp_repair/wizard/cancel_repair.py 2011-01-14 00:11:01 +0000
29+++ mrp_repair/wizard/cancel_repair.py 2012-02-23 13:24:50 +0000
30@@ -64,7 +64,7 @@
31 record_id = context and context.get('active_id', False) or False
32 active_model = context.get('active_model')
33
34- if not record_id or (active_model and active_model != 'mrp.repair'):
35+ if view_type != 'form' or not record_id or active_model != 'mrp.repair':
36 return res
37
38 repair_order = self.pool.get('mrp.repair').browse(cr, uid, record_id, context=context)
39
40=== modified file 'project_gtd/project_gtd.py'
41--- project_gtd/project_gtd.py 2011-12-21 22:15:04 +0000
42+++ project_gtd/project_gtd.py 2012-02-23 13:24:50 +0000
43@@ -104,7 +104,7 @@
44 res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
45 search_extended = False
46 timebox_obj = self.pool.get('project.gtd.timebox')
47- if (res['type'] == 'search') and context.get('gtd', False):
48+ if (res['type'] == 'search') and context.get('gtd'):
49 tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[]), context=context)
50 search_extended =''
51 for time in tt: