Monday, February 5, 2024
2 changes
Resolved issues and error corrections
This fix resolves an issue where the system could get stuck in an infinite loop when validating parent-child relationships in categories. The problem occurred when circular references existed but didn't include the starting item. After this fix, the system properly detects and prevents these problematic circular relationships from being created.
Original PR description
Prevent an infinite loop when the cycle in the parents does not contain the starting id: `3->2->1->2->1...` Example: ``` >>> m=self.env['ir.module.category'] >>> c1,c2,c3 = map(m.browse,[1,2,3]) >>> c2.parent_id = False >>> c3.parent_id = False >>> c1.parent_id = c2 >>> (c3|c2).parent_id = c1 # this never ends ``` With current patch the call to `_check_recursion` successfully detects the new cycle. Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#151549 Forward-Port-Of: odoo/odoo#151294
This fix resolves a critical threading issue in the accounting module where simultaneous discount imports could cause system instability and require server restarts. The problem occurred when multiple processes tried to patch discount calculations at the same time, leading to corrupted or missing methods. This fix ensures that discount imports work safely even when multiple users or processes access the system simultaneously.
Original PR description
The patch method is not thread safe, which is very annoying for SH users for instance. One obvious issue is that during one thread patching the method, other threads will also be impacted and have 100 decimal places for the discount. But it is even worse: * thread A start: original = real_original; new = patchedA * thread B start: original = patchedA; new = patchedB * thread A end: reset original to real_original * thread B end: reset original to patchedA Now at the end of the transaction, the original method simply doesn't exist anymore, and we only have one of the patches, which forces a restart of the server to fix it. [opw-3552839](https://www.odoo.com/web#id=3552839&model=project.task) Forward-Port-Of: odoo/odoo#151874 Forward-Port-Of: odoo/odoo#151787