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
=== modified file 'account/wizard/account_move_journal.py'
--- account/wizard/account_move_journal.py 2011-11-14 11:34:05 +0000
+++ account/wizard/account_move_journal.py 2012-02-23 13:24:50 +0000
@@ -80,7 +80,7 @@
8080
81 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)81 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)
8282
83 if not view_id:83 if view_type != 'form' or not view_id:
84 return res84 return res
8585
86 period_pool = self.pool.get('account.period')86 period_pool = self.pool.get('account.period')
8787
=== modified file 'auction/wizard/auction_lots_buyer_map.py'
--- auction/wizard/auction_lots_buyer_map.py 2011-01-14 00:11:01 +0000
+++ auction/wizard/auction_lots_buyer_map.py 2012-02-23 13:24:50 +0000
@@ -106,7 +106,7 @@
106 context={}106 context={}
107 record_ids = context and context.get('active_ids', []) or []107 record_ids = context and context.get('active_ids', []) or []
108 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)108 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)
109 if context.get('active_model','') != 'auction.lots':109 if view_type != 'form' or context.get('active_model','') != 'auction.lots':
110 return res110 return res
111 lots_obj = self.pool.get('auction.lots')111 lots_obj = self.pool.get('auction.lots')
112 if record_ids:112 if record_ids:
113113
=== modified file 'mrp_repair/wizard/cancel_repair.py'
--- mrp_repair/wizard/cancel_repair.py 2011-01-14 00:11:01 +0000
+++ mrp_repair/wizard/cancel_repair.py 2012-02-23 13:24:50 +0000
@@ -64,7 +64,7 @@
64 record_id = context and context.get('active_id', False) or False 64 record_id = context and context.get('active_id', False) or False
65 active_model = context.get('active_model')65 active_model = context.get('active_model')
66 66
67 if not record_id or (active_model and active_model != 'mrp.repair'):67 if view_type != 'form' or not record_id or active_model != 'mrp.repair':
68 return res68 return res
69 69
70 repair_order = self.pool.get('mrp.repair').browse(cr, uid, record_id, context=context)70 repair_order = self.pool.get('mrp.repair').browse(cr, uid, record_id, context=context)
7171
=== modified file 'project_gtd/project_gtd.py'
--- project_gtd/project_gtd.py 2011-12-21 22:15:04 +0000
+++ project_gtd/project_gtd.py 2012-02-23 13:24:50 +0000
@@ -104,7 +104,7 @@
104 res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)104 res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
105 search_extended = False105 search_extended = False
106 timebox_obj = self.pool.get('project.gtd.timebox')106 timebox_obj = self.pool.get('project.gtd.timebox')
107 if (res['type'] == 'search') and context.get('gtd', False):107 if (res['type'] == 'search') and context.get('gtd'):
108 tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[]), context=context)108 tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[]), context=context)
109 search_extended =''109 search_extended =''
110 for time in tt:110 for time in tt: