[FIX] base: don't unlink base.open_menu but reset it

The ir.actions.todo record base.open_menu is used to redirect the user
to a menu after installing a module.

To do so, a new module override the record changing its action (toward a
menu) and setting its state to "open".

But with f7fe753 when one such changed action is removed after
uninstalling a module (or removing the action by any other way) the
base.open_menu would also be removed. Thus thereafter the open_menu will
not work anymore (since type "automatic" is lost).

With this commit, when whenever base.open_menu is removed, instead its
action will be replaced by base.action_client_base_menu which is the
original action.

closes #11224
related to: #11216, opw-660269
This commit is contained in:
Nicolas Lempereur 2016-03-04 17:42:32 +01:00
parent aca8a8bebc
commit 4309bd311f
1 changed files with 13 additions and 0 deletions

View File

@ -1088,6 +1088,19 @@ Launch Manually Once: after having been launched manually, it sets automatically
}
_order="sequence,id"
@openerp.api.multi
def unlink(self):
if self:
try:
todo_open_menu = self.env.ref('base.open_menu')
# don't remove base.open_menu todo but set its original action
if todo_open_menu in self:
todo_open_menu.action_id = self.env.ref('base.action_client_base_menu').id
self -= todo_open_menu
except ValueError:
pass
return super(ir_actions_todo, self).unlink()
def name_get(self, cr, uid, ids, context=None):
return [(rec.id, rec.action_id.name) for rec in self.browse(cr, uid, ids, context=context)]