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

[FIX] sale_project: project._fetch_sale_order_item_ids fails intermittently #160067

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from

Conversation

mdurepos
Copy link
Contributor

@mdurepos mdurepos commented Apr 1, 2024

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:

  • sale_project/tests/test_sale_project.py:143
  • sale_project/tests/test_project_profitability:175

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

…ot flushed

**Prior Behaviour**

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 environment.

**Behaviour After the Fix**

Tests pass appropriately thanks to the addition of a flush_all call prior to executing the SQL query to fetch sale order items for the project.
@robodoo
Copy link
Contributor

robodoo commented Apr 1, 2024

Pull request status dashboard.

@C3POdoo C3POdoo requested a review from a team April 1, 2024 12:02
@C3POdoo C3POdoo added the Sales Sales label Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sales Sales
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants