From 37920aa303bb2d7f515dfb6b0927f090968a64e6 Mon Sep 17 00:00:00 2001 From: Kevin_Ramirez Date: Thu, 19 Mar 2026 12:49:16 -0500 Subject: [PATCH] se arreglo los furmularios de partes --- backend/alembic/versions/4ad64605fad2_first_migration.py | 2 +- backend/api/v1/modules/a24/inv/inv_parts/models.py | 1 + backend/api/v1/modules/a76/parts/dto.py | 6 +++--- backend/api/v1/modules/a76/parts/service.py | 3 +-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/alembic/versions/4ad64605fad2_first_migration.py b/backend/alembic/versions/4ad64605fad2_first_migration.py index 9ed832a9..9f0e1130 100644 --- a/backend/alembic/versions/4ad64605fad2_first_migration.py +++ b/backend/alembic/versions/4ad64605fad2_first_migration.py @@ -3455,7 +3455,7 @@ def upgrade() -> None: sa.Column('origin_country', sa.String(length=3), nullable=True), sa.Column('fraction_type', sa.String(length=10), nullable=True), sa.Column('agency_code_definition', sa.String(length=50), nullable=True), - sa.Column('carta_porte_codes', sa.String(length=100), nullable=True), + sa.Column('carta_porte', sa.String(length=100), nullable=True), sa.Column('client_part_names', postgresql.JSONB(astext_type=sa.Text()), nullable=True), sa.Column('part_identifiers', postgresql.JSONB(astext_type=sa.Text()), nullable=True), sa.Column('substitute_parts', postgresql.JSONB(astext_type=sa.Text()), nullable=True), diff --git a/backend/api/v1/modules/a24/inv/inv_parts/models.py b/backend/api/v1/modules/a24/inv/inv_parts/models.py index 5ae08e67..48bd6002 100644 --- a/backend/api/v1/modules/a24/inv/inv_parts/models.py +++ b/backend/api/v1/modules/a24/inv/inv_parts/models.py @@ -138,6 +138,7 @@ class InvPart(Base, TenantScopedMixin, TimestampMixin): # --- NUEVOS CAMPOS EXTENSION --- agency_code_definition: Mapped[Optional[str]] = mapped_column(String(50)) # Fila 7 carta_porte: Mapped[Optional[str]] = mapped_column(String(100)) # Fila 10 + client_part_names: Mapped[Optional[list]] = mapped_column(JSONB, nullable=True, default=[]) # Fila 5 part_identifiers: Mapped[Optional[list]] = mapped_column(JSONB, nullable=True, default=[]) # Fila 9 substitute_parts: Mapped[Optional[list]] = mapped_column(JSONB, nullable=True, default=[]) # Pestaña Continuación diff --git a/backend/api/v1/modules/a76/parts/dto.py b/backend/api/v1/modules/a76/parts/dto.py index aa241e22..a6815a01 100644 --- a/backend/api/v1/modules/a76/parts/dto.py +++ b/backend/api/v1/modules/a76/parts/dto.py @@ -6,9 +6,9 @@ from api.v1.modules.a24.inv.inv_aphis.dto import InvPartAphisGeneralDTO # --- SUB-DTO: DATOS ADUANALES (FaData) --- class FaDataDTO(BaseModel): - origin_country: Optional[str] = Field(default=None, pattern=r"^[A-Z]{3}$") - sector: Optional[str] = Field(default=None, pattern=r"^[A-Za-z0-9]{1,8}$") - fraction_type: Optional[Literal["GENERAL", "PROSEC", "ALADI", "TLCS"]] = None + origin_country: Optional[str] = None + sector: Optional[str] = None + fraction_type: Optional[str] = None model_config = ConfigDict(from_attributes=True) diff --git a/backend/api/v1/modules/a76/parts/service.py b/backend/api/v1/modules/a76/parts/service.py index 6779d13f..334f7ffd 100644 --- a/backend/api/v1/modules/a76/parts/service.py +++ b/backend/api/v1/modules/a76/parts/service.py @@ -22,8 +22,7 @@ logger = logging.getLogger(__name__) class PartService: """Servicio para gestión de Partes (Anexo 76 + Anexo 24)""" - # Estos campos están en el modelo pero NO en la DB todavía (faltan las migraciones del usuario) - # Los diferimos en SELECT y los filtramos en INSERT/UPDATE para que el sistema no truene. + # Estos campos están en el modelo pero NO en la DB todavía, faltan las migraciones del usuario MISSING_INV_COLUMNS = [] # Campos que SÍ existen en la DB (Verificados con \d a24.inv_partes)