Skip to content
Snippets Groups Projects
Commit bdaae9ad authored by Romain Derie's avatar Romain Derie
Browse files

[FIX] website: not rely on sudo cache magic for menu visibility


Before this commit conditions based on `_handle_visibility` and
`_get_cached_visibility` did work only by relying on the cache of the
`menu.page_id` being populated when accessing `is_visible` in sudo.
This does not work if the cache is cleared between the calls.

This commit makes sure all 3 conditions have access the record.

The actual issue has not been reproduced locally yet.
The various workers, crons, websocket work on distinct envs - even
through code they cannot impact the cache of another local env outside
the `check_signaling` system which is only used between requests.
For the problem to occur, some intra-request multithreading is needed
but it could not be located so far.

task-3149270

closes odoo/odoo#111217

Signed-off-by: default avatarRomain Derie (rde) <rde@odoo.com>
parent 740c7c61
Branches
Tags
No related merge requests found
......@@ -115,11 +115,12 @@ class Menu(models.Model):
def _compute_visible(self):
for menu in self:
visible = True
if menu.page_id and not menu.user_has_groups('base.group_user') and \
(not menu.page_id.sudo().is_visible or
(not menu.page_id.view_id._handle_visibility(do_raise=False) and
menu.page_id.view_id.visibility != "password")):
visible = False
if menu.page_id and not menu.user_has_groups('base.group_user'):
page_sudo = menu.page_id.sudo()
if (not page_sudo.is_visible
or (not page_sudo.view_id._handle_visibility(do_raise=False)
and page_sudo.view_id.visibility != "password")):
visible = False
menu.is_visible = visible
@api.model
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment