Skip to content

[18.0][FIX] sale_stock_picking_invoicing: stabilize matrix tests#2274

Open
grojof wants to merge 15 commits intoOCA:18.0from
grojof:fix/sale-stock-analytic-test
Open

[18.0][FIX] sale_stock_picking_invoicing: stabilize matrix tests#2274
grojof wants to merge 15 commits intoOCA:18.0from
grojof:fix/sale-stock-analytic-test

Conversation

@grojof
Copy link

@grojof grojof commented Feb 21, 2026

Summary

  • Stabilize sale_stock_picking_invoicing tests for strict matrix variants.
  • Keep existing test goals while isolating environment-dependent side effects.

Why

In strict OCB runs, company creation in one test could trigger internal project creation and fail due additional required fields in mixed stacks. The test now isolates that side effect and remains focused on the default policy assertion.

Changes

  • sale_stock_picking_invoicing/tests/test_sale_stock.py
    • In test_default_value_sale_invoicing_policy, isolate internal project side effects during company creation and keep assertion scope limited to sale_invoicing_policy default behavior.

Validation

  • Local simulation (quick_nodemo) on integrated scenario (approved baseline + migration stack) is green:
    • odoo_exclude=0
    • ocb_exclude=0
    • Run artifacts: tmp-lab/tmp/runs/20260221-231040-pr2063_on_approved_after_fixes_v3

Merge order

4/4 (after #2271 and #2272)

Depends on:

@OCA-git-bot
Copy link
Contributor

Hi @renatonlima, @mbcosta,
some modules you are maintaining are being modified, check this out!

@grojof
Copy link
Author

grojof commented Feb 21, 2026

Cross-reference: migration follow-up has been posted on #2063 for rerun with the updated 18.0 context (after #2271-#2274 stabilization).

Ref: #2063 (comment)

@grojof
Copy link
Author

grojof commented Feb 21, 2026

Update pushed to this PR branch:

  • [18.0][FIX] sale_stock_picking_invoicing: isolate company default policy test

This was identified during a strict integrated local simulation (approved baseline + migration stack).
Current local result for that scenario is green (odoo_exclude=0, ocb_exclude=0).

@grojof
Copy link
Author

grojof commented Feb 21, 2026

Follow-up fix pushed for the failing CI run on this PR:

  • [18.0][FIX] sale_stock_picking_invoicing: guard optional project patch in test

Root cause:

  • test_default_value_sale_invoicing_policy patched _create_internal_project_task unconditionally.
  • In some matrix variants that method is not present on res.company, so the test failed with:
    AttributeError: <class 'odoo.api.res.company'> does not have the attribute '_create_internal_project_task'.

Fix:

  • Apply the patch only when the method exists (hasattr), otherwise create the company directly.
  • Test intent remains unchanged (assert default sale_invoicing_policy).

@grojof
Copy link
Author

grojof commented Feb 21, 2026

Follow-up coverage-oriented refinement pushed:

  • [18.0][FIX] sale_stock_picking_invoicing: simplify optional method patch

Details:

  • Replaced the conditional branch with a single patch.object(..., create=True) flow.
  • This keeps compatibility when _create_internal_project_task is absent and reduces uncovered diff lines.
  • Also fixed a local issue (autospec cannot be used with create=True) by using a valid mock configuration.

Goal: improve Codecov patch coverage while preserving test behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants