|
@ -23,14 +23,22 @@ class WebShortcut(models.Model): |
|
|
def get_user_shortcuts(self): |
|
|
def get_user_shortcuts(self): |
|
|
shortcuts = self.search([('user_id', '=', self.env.user.id)]) |
|
|
shortcuts = self.search([('user_id', '=', self.env.user.id)]) |
|
|
res = [] |
|
|
res = [] |
|
|
|
|
|
trans = self.env['ir.translation'] |
|
|
for shortcut in shortcuts.filtered('menu_id'): |
|
|
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 = shortcut.menu_id.name_get() |
|
|
_name = _name[0][1] if len(_name) else '' |
|
|
_name = _name[0][1] if len(_name) else '' |
|
|
_id = shortcut.menu_id.id |
|
|
_id = shortcut.menu_id.id |
|
|
res.append( |
|
|
res.append( |
|
|
{ |
|
|
{ |
|
|
'id': shortcut.id, |
|
|
'id': shortcut.id, |
|
|
'name': _name, |
|
|
|
|
|
|
|
|
'name': name_translated, |
|
|
'menu_id': (_id, _name) |
|
|
'menu_id': (_id, _name) |
|
|
} |
|
|
} |
|
|
) |
|
|
) |
|
|