odoo/odoo#163625

Created by fw-bot
Merged at c5be302e05ae3e12b8e3188b1f44505f9c2986f5

Statuses:

label
odoo-dev:16.0-15.0-recursive_current_website-bso-65wo-fw
head
e86fecc31c18297f4189ebc39650ba250a2b56ab
merged
1 year ago by Website, Benoit Socias (bso)
odoo/odoo
15.0 #162892
16.0 #163625
saas-16.3 #163940
saas-16.4 #163951
17.0 #164521
saas-17.1 #164536
saas-17.2 #164550
18.0
saas-18.1
saas-18.2
saas-18.3
saas-18.4
master #164580

[FW][FIX] website: neutralize recursion when determining current website

If an ir.rule about websites involves obtaining the rule's evaluation
context, an infinite recursion happens right after login:
- the _login tries to create a res.users.log record which needs to
resolve the ACL
- to do this _eval_context() is called on ir.rule, which in its
website module override uses get_current_website()
- in turn, this calls website's _get_current_website_id() which is
not cached yet
- this involves a search() on website which needs to resolve the ACL
- to do this _eval_context() is again called on ir.rule, causing the
loop

This commit prevent this infinite recursion by disabling the ACL check
when determining the current website id in get_current_website(),
similarly to what is done in 1 in future versions.

Steps to reproduce:
- Create a rule about website with domain_force set to
[(1, '=', 1)].
- Log in from an incognito browser.

=> Error 500 because of an infinite recursion.

task-3884701
opw-3603541

Forward-Port-Of: #162892