Skip to content

Commit a6992e1

Browse files
committed
Fixup import_threaded tests
1 parent c0ebce8 commit a6992e1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/odoo_data_flow/import_threaded.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -960,16 +960,22 @@ def _execute_load_batch( # noqa: C901
960960
field_info = model_fields[clean_field_name]
961961
field_type = field_info.get("type", "unknown")
962962

963-
converted_value = _safe_convert_field_value(
964-
field_name, value, field_type
965-
)
963+
# Sanitize unique ID field values to prevent XML ID constraint violations
964+
if i == uid_index and value is not None:
965+
converted_value = to_xmlid(str(value))
966+
else:
967+
converted_value = _safe_convert_field_value(
968+
field_name, value, field_type
969+
)
966970
processed_row.append(converted_value)
967971
else:
968972
processed_row.append(value)
969973
processed_load_lines.append(processed_row)
970974
load_lines = processed_load_lines
971975
else:
972976
log.debug(
977+
f"First load line (first 10 fields, truncated if large): "
978+
f"{load_lines[0][:10] if load_lines and load_lines[0] else []}"
973979
"Model has no _fields attribute, using raw values for load method"
974980
)
975981
try:

0 commit comments

Comments
 (0)