odoo/odoo#155709

Created by Platform, Paul Morelle (pmo)
Merged at f2765d2cab5671a010404c36842bf1b4c4d6350b

Statuses:

label
odoo-dev:14.0-avoid_module_categ_loop-pmo
head
d28fb7a5a02cc8ac141d2a741c3b0f0a247a7b2f
merged
1 year ago by Upgrade, Christophe Simonis (chs)
odoo/odoo
14.0 #155709
15.0 #161497
16.0 #161523
saas-16.3 #161547
saas-16.4 #161562
17.0 #161583
saas-17.1 #161594
saas-17.2 #161606
18.0
saas-18.1
saas-18.2
saas-18.3
saas-18.4
master #161635

[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 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

Related to odoo/upgrade#5574