'Filter `self` to only keep the menu items that should be visible in
the menu hierarchy of the current user.
Uses a cache for speeding up the computation.'

@api.multi
@api.returns('self')
def _filter_visible_menus(self):

    visible_ids = self._visible_menu_ids((request.debug if request else False))
    return self.filtered((lambda menu: (menu.id in visible_ids)))
