odoo/odoo#161594

Created by fw-bot
Merged at a9149a34df65d9d7dfc239e2880a94b0794d0ca4

Statuses:

label
odoo-dev:saas-17.1-14.0-avoid_module_categ_loop-pmo-CfW2-fw
head
861271a4cc8d858da15f0c32699b62266838fadc
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

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

Forward-Port-Of: #155709