diff --git a/web_shortcut/README.rst b/web_shortcut/README.rst index 5cd32a9c..1906312c 100644 --- a/web_shortcut/README.rst +++ b/web_shortcut/README.rst @@ -28,6 +28,12 @@ To use this module, you need to: :alt: Try me on Runbot :target: https://runbot.odoo-community.org/runbot/162/10.0 +Known Issues +============ +Clicking shortcut menu item sometimes doesn't trigger the left side submenu widget +updating except reloading the whole page. +Client side may raise TypeError exception randomly: this.active_view is null. + Bug Tracker =========== @@ -46,6 +52,7 @@ Contributors * Dennis Sluijk * Odoo SA * Thomas Binsfeld +* Henry Zhou (MAXodoo) Maintainer ---------- diff --git a/web_shortcut/models/web_shortcut.py b/web_shortcut/models/web_shortcut.py index aafddd9d..c7a43587 100644 --- a/web_shortcut/models/web_shortcut.py +++ b/web_shortcut/models/web_shortcut.py @@ -23,14 +23,27 @@ class WebShortcut(models.Model): def get_user_shortcuts(self): shortcuts = self.search([('user_id', '=', self.env.user.id)]) res = [] + trans = self.env['ir.translation'] for shortcut in shortcuts.filtered('menu_id'): + name_translated = trans._get_source('ir.ui.menu,name', 'model', + self.env.user.lang, + shortcut.menu_id.name, + shortcut.menu_id.id) + current = shortcut.menu_id + while current.parent_id: + current = current.parent_id + name_translated = ' / '.join(( + trans._get_source('ir.ui.menu,name', 'model', + self.env.user.lang, + current.name, current.id), + name_translated)) _name = shortcut.menu_id.name_get() _name = _name[0][1] if len(_name) else '' _id = shortcut.menu_id.id res.append( { 'id': shortcut.id, - 'name': _name, + 'name': name_translated, 'menu_id': (_id, _name) } )