odoo/enterprise#61159

Created by Framework (ORM), Chong Wang (cwg)
Merged at d567c937f39e1d46a95037fe20f3cf93ec8e5d56

Statuses:

Linked pull requests
label
odoo-dev:master-base-check-cycle-sql-cwg
head
afb70bf00a0e314c09c361deebb895a2cb343dc6
merged
1 year ago by Framework (ORM), Raphael Collet
odoo/odoo odoo/enterprise
master #162656 #61159

[IMP] base: _has_cycle replaces _check_recursion in SQL

Implement checking recursion using a single recursive SQL query. The query starts from self.ids and follows a relationship. We can use the same query for both many2many and many2one relationships.

_has_cycle now will not return False if some reachable records are part of a loop and are not in self.ids. This is acceptable because this method is called after modifications with ids of changed records and we can suppose that unchanged records did not introduce a loop.

odoo/odoo#162656