Merge pull request 'feature/catalogo-pedimento' (#219) from feature/catalogo-pedimento into development

Reviewed-on: ADUANASOFT/anexo76#219
This commit is contained in:
2026-03-18 03:53:00 +00:00
16 changed files with 355 additions and 70 deletions

View File

@@ -35,7 +35,7 @@ def load_pedimentos_fk_sets(
valid_clave_regimen_tipo, # (pedimento_code, regimen_code, type_code)
valid_aduana_seccion, # customs_code
existing_pedimento_keys, # key strings para actualizar
valid_anexo22_claves, # stub vacío hasta tener catálogo
valid_anexo22_claves, # catálogo de transporte Anexo 22 (pedimento_transport_catalog.code)
valid_patentes, # CustomsBroker.license (tenant/company)
short_name_to_id, # short_name normalizado (upper) -> client id (primera aparición gana)
"""
@@ -48,6 +48,9 @@ def load_pedimentos_fk_sets(
from api.v1.modules.public.reference_data.customs_sections.models import CustomsSection
from api.v1.modules.public.reference_data.pedimento_codes.models import PedimentoCode
from api.v1.modules.public.reference_data.pedimento_regimens.models import RegimenPedimento
from api.v1.modules.public.reference_data.pedimento_transport_catalog.models import (
PedimentoTransportCatalog,
)
valid_client_ids: Set[int] = set()
valid_regimes: Set[str] = set()
@@ -96,6 +99,10 @@ def load_pedimentos_fk_sets(
for cs in session.query(CustomsSection).all():
valid_aduana_seccion.add(cs.customs_code.strip())
for tm in session.query(PedimentoTransportCatalog.code).all():
if (tm[0] or "").strip():
valid_anexo22_claves.add((tm[0] or "").strip().upper())
for cb in (
session.query(CustomsBroker)
.filter(