Skip to content
This repository was archived by the owner on Aug 16, 2026. It is now read-only.
Closed
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
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def precommit(session: nox.Session) -> None:
"lint",
external=True,
)
session.install("pydoclint")
session.run("pre-commit", *args, external=True)
if args and args[0] == "install":
activate_virtualenv_in_precommit_hooks(session)
Expand Down
5 changes: 5 additions & 0 deletions src/odoo_data_flow/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ def import_cmd(connection_file: str, **kwargs: Any) -> None:
except (ValueError, SyntaxError) as e:
log.error(f"Invalid --context dictionary provided: {e}")
return

groupby = kwargs.get("groupby")
if groupby:
kwargs["groupby"] = [col.strip() for col in groupby.split(",")]

run_import(**kwargs)


Expand Down
35 changes: 35 additions & 0 deletions tests/test_import_threaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,3 +661,38 @@ def test_recursive_batching_group_col_not_found(self) -> None:
mock_log.error.assert_called_once_with(
"Grouping column 'non_existent' not found. Cannot use --groupby."
)

def test_recursive_batching_with_special_chars_in_col_name(self) -> None:
"""Test batching with special characters in column names."""
from odoo_data_flow.import_threaded import _recursive_create_batches

header = ["id", "name", "partner_id/id"]
data = [
["1", "A", "p1"],
["2", "B", "p1"],
["3", "C", "p2"],
]
batches = list(
_recursive_create_batches(data, ["partner_id/id"], header, 10, False)
)
assert len(batches) == 2
assert batches[0][1][0][2] == "p1"
assert batches[1][1][0][2] == "p2"

def test_recursive_batching_multiple_cols_with_special_chars(self) -> None:
"""Test batching with multiple columns, one with special characters."""
from odoo_data_flow.import_threaded import _recursive_create_batches

header = ["id", "name", "partner_id/id", "company_id"]
data = [
["1", "A", "p1", "c1"],
["2", "B", "p1", "c2"],
["3", "C", "p2", "c1"],
["4", "D", "p1", "c1"],
]
batches = list(
_recursive_create_batches(
data, ["partner_id/id", "company_id"], header, 10, False
)
)
assert len(batches) == 3
Loading