[IMP] after a module installation, reload the client and open the menu Feeds
bzr revid: rco@openerp.com-20120718135010-4933mmgw3n18epvy
This commit is contained in:
parent
ebec068b6b
commit
26665b7743
|
@ -363,8 +363,9 @@ class module(osv.osv):
|
|||
if config.get('type') not in ('ir.actions.reload', 'ir.actions.act_window_close'):
|
||||
return config
|
||||
|
||||
# reload the client
|
||||
menu_ids = self.root_menus(cr,uid,ids,context)
|
||||
# reload the client; open the first available root menu
|
||||
menu_obj = self.pool.get('ir.ui.menu')
|
||||
menu_ids = menu_obj.search(cr, uid, [('parent_id', '=', False)], context=context)
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'reload',
|
||||
|
@ -649,29 +650,6 @@ class module(osv.osv):
|
|||
_logger.critical('module %s: invalid quality certificate: %s', mod.name, mod.certificate)
|
||||
raise osv.except_osv(_('Error'), _('Module %s: Invalid Quality Certificate') % (mod.name,))
|
||||
|
||||
def root_menus(self, cr, uid, ids, context=None):
|
||||
""" Return root menu ids the menus created by the modules whose ids are
|
||||
provided.
|
||||
|
||||
:param list[int] ids: modules to get menus from
|
||||
"""
|
||||
values = self.read(cr, uid, ids, ['name'], context=context)
|
||||
module_names = [i['name'] for i in values]
|
||||
|
||||
ids = self.pool.get('ir.model.data').search(cr, uid, [ ('model', '=', 'ir.ui.menu'), ('module', 'in', module_names) ], context=context)
|
||||
values = self.pool.get('ir.model.data').read(cr, uid, ids, ['res_id'], context=context)
|
||||
all_menu_ids = [i['res_id'] for i in values]
|
||||
|
||||
root_menu_ids = []
|
||||
for menu in self.pool.get('ir.ui.menu').browse(cr, uid, all_menu_ids, context=context):
|
||||
while menu.parent_id:
|
||||
menu = menu.parent_id
|
||||
if not menu.id in root_menu_ids:
|
||||
root_menu_ids.append((menu.sequence,menu.id))
|
||||
root_menu_ids.sort()
|
||||
root_menu_ids = [i[1] for i in root_menu_ids]
|
||||
return root_menu_ids
|
||||
|
||||
class module_dependency(osv.osv):
|
||||
_name = "ir.module.module.dependency"
|
||||
_description = "Module dependency"
|
||||
|
|
|
@ -70,10 +70,14 @@ class res_config_configurable(osv.osv_memory):
|
|||
res = next.action_launch(context=context)
|
||||
res['nodestroy'] = False
|
||||
return res
|
||||
#if there is no next action and if html is in the context: reload instead of closing
|
||||
if context and 'html' in context:
|
||||
return {'type' : 'ir.actions.reload'}
|
||||
return {'type' : 'ir.actions.act_window_close'}
|
||||
# reload the client; open the first available root menu
|
||||
menu_obj = self.pool.get('ir.ui.menu')
|
||||
menu_ids = menu_obj.search(cr, uid, [('parent_id', '=', False)], context=context)
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'reload',
|
||||
'params': {'menu_id': menu_ids and menu_ids[0] or False},
|
||||
}
|
||||
|
||||
def start(self, cr, uid, ids, context=None):
|
||||
return self.next(cr, uid, ids, context)
|
||||
|
|
Loading…
Reference in New Issue