Skip to content

fix: create-missing-variants search on Odoo 19 + e2e registry reload#215

Merged
bosd merged 2 commits into
masterfrom
fix/e2e-variant-workflow
Jul 17, 2026
Merged

fix: create-missing-variants search on Odoo 19 + e2e registry reload#215
bosd merged 2 commits into
masterfrom
fix/e2e-variant-workflow

Conversation

@bosd

@bosd bosd commented Jul 17, 2026

Copy link
Copy Markdown
Member

What

Makes the nightly End-to-End Integrity Tests workflow green again. It has been failing on Odoo 16/17/19 (18 passed) — all from the single tests/e2e/test_variant_workflow.py scenario, which broke two different ways:

1. Odoo 19 — real product-code bug

variant_manager searched templates on product_variant_count, a non-stored computed field. Odoo 19 rejects it in a search domain:

ValueError: Cannot convert product.template.product_variant_count to SQL because it is not stored

Fix: filter on the product_variant_ids one2many (a real relational field), which expresses "no variants" across all Odoo versions. This fixes create-missing-variants on Odoo 19 for real users, not just the test. The unit-test assertion is updated to match.

2. Odoo 16/17 — e2e harness registry-reload gap

The product_module fixture installs product mid-session via a separate -i product --stop-after-init process, but the long-running server had already cached target_db's (base-only) registry from earlier tests and didn't reload it:

odoo.exceptions.UserError: Object product.template doesn't exist

Fix: restart the Odoo service after the install (_runtime.restart_service + wait_http_ready) so the next request rebuilds the registry with product. Proved directly: product.template failed before the restart and succeeded after.

Verification

Ran the full -m "not large" suite against a fresh managed stack on Odoo 16, 17, 18 and 1919 passed on every version. Unit suite: 1431 passed.

Files

  • src/fluvo/lib/actions/variant_manager.py — search the relation, not the count (2 sites)
  • tests/test_variant_manager.py — assertion updated
  • tests/e2e/_runtime.pyrestart_service helper
  • tests/e2e/conftest.py — restart + wait after mid-session product install

Two fixes that make the nightly e2e integrity workflow green again (it was
failing on Odoo 16/17/19; 18 passed). Both surfaced only through the single
tests/e2e/test_variant_workflow scenario.

- variant_manager: filter templates on the ``product_variant_ids`` relation
  instead of ``product_variant_count``. The count is a non-stored computed field
  and Odoo 19 rejects it in a search domain ("Cannot convert ... to SQL because
  it is not stored"); the one2many is a real relational field, so "no variants"
  is expressible across all versions. Fixes create-missing-variants on Odoo 19
  for real users, not just the test. Unit-test assertion updated to match.

- e2e harness: restart the Odoo service after the ``product_module`` fixture
  installs ``product`` mid-session. The long-running server caches target_db's
  (base-only) registry the first time it serves it, and a separate
  ``-i product --stop-after-init`` install does not reliably make it reload
  (Object product.template doesn't exist on Odoo 16/17). A restart clears the
  in-memory registry cache so the next request rebuilds it with product.

Verified: full ``-m "not large"`` suite passes on fresh Odoo 16, 17, 18 and 19
(19/19 each).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the search domains in variant_manager.py to filter on the product_variant_ids relation instead of the non-stored computed field product_variant_count, preventing search errors in Odoo 19. Additionally, it introduces a helper function to restart service containers in E2E tests, ensuring the Odoo registry cache is cleared and rebuilt after mid-session module installations. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

pydoclint's rendering of the 'batch' and 'odoo_endpoint' DOC404 yield types
drifted (Any -> list[Any], (str, object) -> dict[str, object]) with the current
resolved toolchain, so the committed baseline no longer matched and the pydoclint
pre-commit hook failed. Update just those two lines to the current rendering. No
source change.
@bosd
bosd force-pushed the fix/e2e-variant-workflow branch from 3ebc56e to 2d0252f Compare July 17, 2026 09:06
@bosd
bosd merged commit f9beecf into master Jul 17, 2026
25 checks passed
@bosd
bosd deleted the fix/e2e-variant-workflow branch July 17, 2026 09:09
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.

1 participant