odoo/odoo#155709

Created by Paul Morelle (pmo)
label
odoo-dev:14.0-avoid_module_categ_loop-pmo
head
d28fb7a5a02cc8ac141d2a741c3b0f0a247a7b2f
target
14.0
merged
1 month ago by Upgrade, Christophe Simonis (chs)
forward-ports

[IMP] base: avoid infinite loops in _update_category

When updating the categories, if by any chance there is a loop in the category hierarchy, the current code was falling into an infinite loop.

With this commit, the graph loop is broken by clearing a parent_id, and if the resulting module category path is wrong, a clean new one will be recreated anyway.

This allows unblocking uncomfortable situations where people cannot update the modules list any more. In 15.0, [a check](https://github.com/odoo/odoo/commit/6932714200d158a21bf10b90b2f71fa5cae0b13f) has been introduced to prevent the existence of recursive categories, but as it is a python check it doesn't prevent corrupted data to remain corrupted.

[OPW-3704007](https://www.odoo.com/web#id=3704007&model=project.task)

Related to odoo/upgrade#5574