Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] base: avoid infinite loops in _update_category #155709

Closed
wants to merge 1 commit into from

Conversation

madprog
Copy link
Contributor

@madprog madprog commented Feb 28, 2024

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

@madprog madprog requested a review from KangOl February 28, 2024 09:49
@robodoo
Copy link
Contributor

robodoo commented Feb 28, 2024

@C3POdoo C3POdoo requested review from a team, rco-odoo and ryv-odoo and removed request for a team February 28, 2024 09:51
@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Feb 28, 2024
@ryv-odoo
Copy link
Contributor

Hello @madprog

IMHO, if you have broken data, you should fix that data instead of adding code in order to take in account for broken data (and the warning won't be seen by the user). But if it's really necessary (if there are already a lot of databases with this problem), please don't forward it to the master.

@aj-fuentes
Copy link
Contributor

@ryv-odoo we are still getting this issue in upgrades, and there is no simple way to fix it unless standard code is resilient to this case. Happening at least in 16.3 also.

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

[1]: odoo/odoo@6932714
@KangOl KangOl force-pushed the 14.0-avoid_module_categ_loop-pmo branch from b0c6897 to d28fb7a Compare April 10, 2024 13:11
@KangOl
Copy link
Contributor

KangOl commented Apr 11, 2024

@robodoo r+

robodoo pushed a commit that referenced this pull request Apr 11, 2024
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][1] 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

[1]: 6932714

closes #155709

Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
@robodoo robodoo closed this Apr 11, 2024
@fw-bot fw-bot deleted the 14.0-avoid_module_categ_loop-pmo branch April 25, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants