[FIX] sale_project: project._fetch_sale_order_item_ids fails intermittently #160067
+2
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the issue/feature this PR addresses:
Tests dependent on project.task's _get_sale_order_items method fail intermittently. This was noted while migrating a custom module from 15.0 to 17.0 and ensuring it passed all tests. In debugging, it was noted that the project.task and sale.order.line records expected to be found by the query in project.project's _get_sale_order_items_query were in fact not present in the database despite the objects being accessible in the memory. This was confirmed by observing records in memory at a break point during test debugging as well as running SQL queries using the same debug environment.
Current behavior before PR:
Intermittent test failures at:
Desired behavior after PR is merged:
Sale order items are correctly fetched by project._get_sale_order_items() regardless of whether there are pending computations and updates to the database. Tests mentioned above now pass as expected more consistently.
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr