refactor: update validation logic and enhance seed data script

This commit is contained in:
2026-03-04 19:13:05 -06:00
parent e1f494fd18
commit 40c2cc4f32
2 changed files with 216 additions and 17 deletions

View File

@@ -112,8 +112,8 @@ def validate_common(
return # Stop here if pedimento not found
if not invoice.compliance_mx.is_regime_change:
# Validar que el pedimento sea de importación (hardcoded restriction)
if pedimento.operation_type != "imp":
# Validar que el pedimento sea de importación
if pedimento.operation_type != invoice.operation_type:
errors.add_error(
field="compliance_mx.pedimento_id",
message="El Pedimento seleccionado no corresponde a una Importación.",
@@ -489,9 +489,7 @@ def validate_common(
incoterm_exists = (
db.query(Incoterm)
.filter(
Incoterm.code == invoice.logistics.incoterm,
Incoterm.tenant_id == tenant_id,
Incoterm.company_id == company_id,
Incoterm.code == invoice.logistics.incoterm
)
.first()
)