Skip to content

Commit cb5a22c

Browse files
bosdbosd
authored andcommitted
fix(import): Correct progress bar handling in threaded import
Ensure the progress bar is correctly updated and closed in the threaded import module, preventing potential resource leaks and providing accurate progress feedback.
1 parent 90cdf43 commit cb5a22c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/odoo_data_flow/import_threaded.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ def import_data(
983983
tuple[bool, int]: True if the entire import process completed without any
984984
critical, process-halting errors, False otherwise.
985985
"""
986-
_context, _deferred, _ignore = (
986+
context, deferred, ignore = (
987987
context or {"tracking_disable": True},
988988
deferred_fields or [],
989989
ignore or [],
@@ -1042,9 +1042,9 @@ def import_data(
10421042
header,
10431043
all_data,
10441044
unique_id_field,
1045-
_deferred,
1046-
_ignore,
1047-
_context,
1045+
deferred,
1046+
ignore,
1047+
context,
10481048
fail_writer,
10491049
fail_handle,
10501050
max_connection,
@@ -1063,7 +1063,7 @@ def import_data(
10631063
pass_2_successful = True # Assume success if no Pass 2 is needed.
10641064
updates_made = 0
10651065

1066-
if _deferred:
1066+
if deferred:
10671067
pass_2_successful, updates_made = _orchestrate_pass_2(
10681068
progress,
10691069
model_obj,
@@ -1072,8 +1072,8 @@ def import_data(
10721072
all_data,
10731073
unique_id_field,
10741074
id_map,
1075-
_deferred,
1076-
_context,
1075+
deferred,
1076+
context,
10771077
fail_writer,
10781078
fail_handle,
10791079
max_connection,

tests/test_import_threaded.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ def test_read_data_file_no_id_column(self, tmp_path: Path) -> None:
501501
source_file = tmp_path / "source.csv"
502502
source_file.write_text("name,age\nAlice,30")
503503
with pytest.raises(
504-
ValueError, match="Source file must contain an 'id' column."
504+
ValueError, match=r"Source file must contain an 'id' column."
505505
):
506506
_read_data_file(str(source_file), ",", "utf-8", 0)
507507

0 commit comments

Comments
 (0)