diff --git a/backend/api/v1/modules/a76/items/imports/temporary/validators/create.py b/backend/api/v1/modules/a76/items/imports/temporary/validators/create.py
index d6080ac3..2507f953 100644
--- a/backend/api/v1/modules/a76/items/imports/temporary/validators/create.py
+++ b/backend/api/v1/modules/a76/items/imports/temporary/validators/create.py
@@ -33,14 +33,8 @@ def validate_create(
code="REQUIRED"
)
- # 2. Validar part_number_id
- if not line.part_number_id:
- errors.add_error(
- field="part_number_id",
- message="Part Number ID es obligatorio",
- solution="Selecciona un número de parte válido del catálogo",
- code="REQUIRED"
- )
+ # 2. Validar part_number_id (OPCIONAL - ya no es obligatorio)
+ # El campo part_number_id ahora es opcional
# 3. Validar class_id
if not line.class_id:
@@ -115,4 +109,22 @@ def validate_create(
message="Description in Spanish es obligatorio",
solution="Proporciona una descripción del item en español",
code="REQUIRED"
+ )
+
+ # 8. Validar customs.origin_country
+ if not line.customs or not line.customs.origin_country:
+ errors.add_error(
+ field="customs.origin_country",
+ message="País de Origen es obligatorio",
+ solution="Selecciona el país de origen del item",
+ code="REQUIRED"
+ )
+
+ # 9. Validar customs.fraction_type
+ if not line.customs or not line.customs.fraction_type:
+ errors.add_error(
+ field="customs.fraction_type",
+ message="Tipo de Tarifa es obligatorio",
+ solution="Selecciona el tipo de tarifa (GENERAL, PROSEC, ALADI, TLCS)",
+ code="REQUIRED"
)
\ No newline at end of file
diff --git a/backend/api/v1/modules/a76/items/imports/temporary/validators/update.py b/backend/api/v1/modules/a76/items/imports/temporary/validators/update.py
index 8feaa515..08aed895 100644
--- a/backend/api/v1/modules/a76/items/imports/temporary/validators/update.py
+++ b/backend/api/v1/modules/a76/items/imports/temporary/validators/update.py
@@ -138,14 +138,25 @@ def validate_update(
# 8. Validar datos aduanales si se proporcionan
if line.customs:
- # Validar país de origen
- if line.customs.origin_country is not None and not line.customs.origin_country:
- errors.add_error(
- field="customs.origin_country",
- message="Origin Country no puede estar vacío",
- solution="Selecciona el país de origen del item",
- code="REQUIRED"
- )
+ # Validar país de origen (OBLIGATORIO)
+ if line.customs.origin_country is not None:
+ if not line.customs.origin_country:
+ errors.add_error(
+ field="customs.origin_country",
+ message="País de Origen es obligatorio",
+ solution="Selecciona el país de origen del item",
+ code="REQUIRED"
+ )
+
+ # Validar tipo de tarifa (OBLIGATORIO)
+ if line.customs.fraction_type is not None:
+ if not line.customs.fraction_type:
+ errors.add_error(
+ field="customs.fraction_type",
+ message="Tipo de Tarifa es obligatorio",
+ solution="Selecciona el tipo de tarifa (GENERAL, PROSEC, ALADI, TLCS)",
+ code="REQUIRED"
+ )
# Validar preferencia arancelaria
if line.customs.preference is not None and not line.customs.preference:
@@ -184,15 +195,16 @@ def validate_update(
code="INVALID_VALUE"
)
- # 9. Validar descripción en español si se proporciona
+ # 9. Validar descripción en español (OBLIGATORIA)
if line.description and hasattr(line.description, 'description_spanish'):
- if line.description.description_spanish is not None and not line.description.description_spanish:
- errors.add_error(
- field="description.description_spanish",
- message="La descripción en español no puede estar vacía",
- solution="Proporciona una descripción del item en español",
- code="REQUIRED"
- )
+ if line.description.description_spanish is not None:
+ if not line.description.description_spanish.strip():
+ errors.add_error(
+ field="description.description_spanish",
+ message="Descripción en Español es obligatoria",
+ solution="Proporciona una descripción del item en español",
+ code="REQUIRED"
+ )
# 10. Validar subpartidas si se actualizan
if line.fa_data and line.fa_data.is_subitem:
diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-configuration.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-configuration.svelte
index 831d2739..e71c6096 100644
--- a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-configuration.svelte
+++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-configuration.svelte
@@ -87,7 +87,7 @@