Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pydoclint-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ src/fluvo/lib/internal/rpc_thread.py
DOC203: Method `RpcThread.spawn_thread` return type(s) in docstring not consistent with the return annotation. Return annotation has 1 type(s); docstring return section has 0 type(s).
--------------------
src/fluvo/lib/internal/tools.py
DOC404: Function `batch` yield type(s) in docstring not consistent with the return annotation. The yield type (the 0th arg in Generator[...]/Iterator[...]): Any; docstring "yields" section types:
DOC404: Function `batch` yield type(s) in docstring not consistent with the return annotation. The yield type (the 0th arg in Generator[...]/Iterator[...]): list[Any]; docstring "yields" section types:
DOC201: Function `to_m2o` does not have a return section in docstring
DOC203: Function `to_m2o` return type(s) in docstring not consistent with the return annotation. Return annotation has 1 type(s); docstring return section has 0 type(s).
DOC001: Function/method `to_m2m`: Potential formatting errors in docstring. Error message: Expected a colon in 'separated by commas.'. (Note: DOC001 could trigger other unrelated violations under this function/method too. Please fix the docstring formatting first.)
Expand Down Expand Up @@ -377,7 +377,7 @@ tests/e2e/assertions.py
tests/e2e/conftest.py
DOC101: Function `odoo_endpoint`: Docstring contains fewer arguments than in function signature.
DOC103: Function `odoo_endpoint`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [request: pytest.FixtureRequest].
DOC404: Function `odoo_endpoint` yield type(s) in docstring not consistent with the return annotation. The yield type (the 0th arg in Generator[...]/Iterator[...]): (str, object); docstring "yields" section types:
DOC404: Function `odoo_endpoint` yield type(s) in docstring not consistent with the return annotation. The yield type (the 0th arg in Generator[...]/Iterator[...]): dict[str, object]; docstring "yields" section types:
--------------------
tests/e2e/generators.py
DOC101: Function `write_csv`: Docstring contains fewer arguments than in function signature.
Expand Down
10 changes: 8 additions & 2 deletions src/fluvo/lib/actions/variant_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ def run_create_missing_variants(
return False

search_domain: list[Any] = list(domain) if domain else []
search_domain.append(("product_variant_count", "=", 0))
# Filter on the ``product_variant_ids`` relation, not ``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.
search_domain.append(("product_variant_ids", "=", False))

try:
orphan_ids = template_obj.search(search_domain)
Expand Down Expand Up @@ -153,7 +157,9 @@ def check_missing_variants_after_import(
template_obj.search(
[
("id", "in", db_ids[i : i + 2000]),
("product_variant_count", "=", 0),
# See run_create_missing_variants: search the relation, not
# the non-stored product_variant_count (unsearchable on 19).
("product_variant_ids", "=", False),
]
)
)
Expand Down
16 changes: 16 additions & 0 deletions tests/e2e/_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ def exec_in(
return _compose("exec", "-T", service, *command, timeout=timeout)


def restart_service(service: str, timeout: int = 120) -> None:
"""Restart a running service container.

Used after a mid-session module install: the long-running Odoo server caches a
database's registry the first time it serves it, and installing a module from a
separate ``--stop-after-init`` process does not reliably make the running server
reload that cached registry (observed on Odoo 16/17). A restart clears the
in-memory registry cache so the next request rebuilds it with the new module.

Args:
service: The compose service to restart (e.g. ``odoo``).
timeout: Seconds to allow for the restart command.
"""
_compose("restart", service, timeout=timeout)


def create_database(db_name: str, timeout: int = 600) -> None:
"""Initialise a fresh Odoo database with the ``base`` module, no demo data.

Expand Down
6 changes: 6 additions & 0 deletions tests/e2e/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,10 @@ def product_module(odoo_endpoint: dict[str, object], target_db: str) -> str:
if not odoo_endpoint["managed"]:
pytest.skip("variant workflow test requires the managed Odoo stack")
_runtime.install_module(target_db, "product")
# The long-running server has already cached target_db's (base-only) registry
# from earlier tests; a mid-session install does not reliably make it reload
# (Object product.template doesn't exist on Odoo 16/17). Restart so the next
# request rebuilds the registry with 'product', then wait for it to come back.
_runtime.restart_service("odoo")
_runtime.wait_http_ready(str(odoo_endpoint["host"]), int(odoo_endpoint["port"]))
return "product"
2 changes: 1 addition & 1 deletion tests/test_variant_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_extra_domain_is_combined_with_the_no_variant_filter(
mock_get.return_value = conn
run_create_missing_variants("conn.conf", domain=[("categ_id", "=", 5)])
template.search.assert_called_once_with(
[("categ_id", "=", 5), ("product_variant_count", "=", 0)]
[("categ_id", "=", 5), ("product_variant_ids", "=", False)]
)


Expand Down
Loading