diff --git a/noxfile.py b/noxfile.py index d00df751..416efc67 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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) diff --git a/src/odoo_data_flow/__main__.py b/src/odoo_data_flow/__main__.py index fdcf5a2d..b773f72b 100644 --- a/src/odoo_data_flow/__main__.py +++ b/src/odoo_data_flow/__main__.py @@ -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) diff --git a/tests/test_import_threaded.py b/tests/test_import_threaded.py index 118582a0..71e95b14 100644 --- a/tests/test_import_threaded.py +++ b/tests/test_import_threaded.py @@ -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