feat(import): move required field check to end of process

This commit is contained in:
Herculino Trotta
2025-01-23 21:09:53 -03:00
parent d0172b5524
commit 928ad33111

View File

@@ -406,15 +406,15 @@ class ImportService:
if value is None:
value = mapping.default
if mapping.required and value is None and not mapping.transformations:
raise ValueError(f"Required field {field} is missing")
# Apply transformations
if mapping.transformations:
value = self._transform_value(value, mapping, row)
value = self._coerce_type(value, mapping)
if mapping.required and value is None:
raise ValueError(f"Required field {field} is missing")
if value is not None:
# Remove the prefix from the target field
target = mapping.target