So, just to help out, if you are in trouble with such a problem of selecting the right view for the job (see my previous post), you can still have a look to the fleet_maintenance module from trunk-extra-addons, or look at the relevant part of it here:
Code:
class stock_location(osv.osv):
_inherit = "stock.location"
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False):
if view_type == 'form' and context.get('fleet_type', False) == 'sub_fleet':
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','stock.location.fleet.form.sub_fleet_maintenance')])[0]
elif view_type == 'form' and context.get('fleet_type', False) == 'fleet':
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','stock.location.fleet.form.fleet_maintenance')])[0]
#elif view_type == 'tree' and context.get('fleet_type', False) == 'sub_fleet':
# pass
#elif view_type == 'tree' and context.get('fleet_type', False) == 'fleet':
# pass
return super(stock_location, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar)
Fabien told we might create a blueprint to have a similar view selection ability in relation fields in a declarative way with an XML attribute with no need to code like that, any thought? We might create such a blueprint then.
Hope this helps
Raphaël Valyi.