Xavier (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-fields_view_get-fixes-xmo 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-fields_view_get-fixes-xmo/+merge/94369

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)
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-fields_view_get-fixes-xmo/+merge/94369
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-fields_view_get-fixes-xmo.
=== 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 @@
 
         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)
 
-        if not view_id:
+        if view_type != 'form' or not view_id:
             return res
 
         period_pool = self.pool.get('account.period')

=== 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 @@
             context={}
         record_ids = context and context.get('active_ids', []) or []
         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)
-        if context.get('active_model','') != 'auction.lots':
+        if view_type != 'form' or context.get('active_model','') != 'auction.lots':
             return res
         lots_obj = self.pool.get('auction.lots')
         if record_ids:

=== 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 @@
         record_id = context and context.get('active_id', False) or False        
         active_model = context.get('active_model')
         
-        if not record_id or (active_model and active_model != 'mrp.repair'):
+        if view_type != 'form' or not record_id or active_model != 'mrp.repair':
             return res
         
         repair_order = self.pool.get('mrp.repair').browse(cr, uid, record_id, context=context)

=== 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 @@
         res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
         search_extended = False
         timebox_obj = self.pool.get('project.gtd.timebox')
-        if (res['type'] == 'search') and context.get('gtd', False):
+        if (res['type'] == 'search') and context.get('gtd'):
             tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[]), context=context)
             search_extended =''
             for time in tt:

_______________________________________________
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