odoo/odoo#152062

Created by fw-bot
Merged at 5d726c933b591468bcef85a4e14b183278a00e5b

Statuses:

label
odoo-dev:saas-16.4-11.0-fix_recursion_check-afu-MT2F-fw
head
0a9c59c1690634be7ecc16a38970e8766cc88a01
merged
1 year ago by Upgrade, Alvaro Fuentes Suarez (afu)
odoo/odoo
11.0 #151294
12.0 #151538
saas-12.3 #151549
13.0 #151799
14.0 #151961
15.0 #151966
saas-15.2 #151980
16.0 #151996
saas-16.1 #152016
saas-16.2 #152030
saas-16.3 #152047
saas-16.4 #152062
17.0 #152080
saas-17.1 #152652
18.0
saas-18.1
saas-18.2
saas-18.3
saas-18.4
master #152669

[FW][FIX] core: fix recursion check

Prevent an infinite loop when the cycle in the parents does not contain the starting id: 3->2->1->2->1...

Example:

>>> m=self.env['ir.module.category']
>>> c1,c2,c3 = map(m.browse,[1,2,3])
>>> c2.parent_id = False
>>> c3.parent_id = False
>>> c1.parent_id = c2
>>> (c3|c2).parent_id = c1  # this never ends

With current patch the call to _check_recursion successfully detects the new cycle.

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #151549
Forward-Port-Of: #151294