odoo/odoo#151799

Created by fw-bot
label
odoo-dev:13.0-11.0-fix_recursion_check-afu-1gPe-fw
head
82772bbcadb141a7558da993fc92ce12de8bda6a
target
13.0
merged
3 months ago by Framework (ORM), Xavier Dollé (xdo)
forward-port of
odoo/odoo#151294

[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: odoo/odoo#151549
Forward-Port-Of: odoo/odoo#151294