diff --git a/backend/api/v1/modules/a76/invoices/models.py b/backend/api/v1/modules/a76/invoices/models.py index a5337664..10d22c0c 100644 --- a/backend/api/v1/modules/a76/invoices/models.py +++ b/backend/api/v1/modules/a76/invoices/models.py @@ -38,7 +38,7 @@ class InvoiceHeader(Base, TenantScopedMixin, TimestampMixin): id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True) # Identifiers - system: Mapped[Optional[str]] = mapped_column(String(10)) # SISTEMA / Sistema de origen <-- no tiene campo en la antigua base de datos, sera para fixed-asset(scaf), inventory(scaii) + system: Mapped[Optional[str]] = mapped_column(String(12)) # SISTEMA / Sistema de origen <-- no tiene campo en la antigua base de datos, sera para fixed_asset(scaf), inventory(scaii) operation_type: Mapped[OperationType] = mapped_column(String(10)) # TIPOMOVIMIENTO / Clasifica imp/exp/sm/ctm invoice_type: Mapped[Optional[str]] = mapped_column(ForeignKey("public.invoice_types.key")) # TIPOFACTURA / TIPODOC invoice_number: Mapped[Optional[str]] = mapped_column(String(20)) # FACTURAIMPO/FACTURAEXPO/FACTURAREMISION/FACTURAENVIO/FACTURASALIDA diff --git a/backend/api/v1/modules/a76/invoices/schemas.py b/backend/api/v1/modules/a76/invoices/schemas.py index 2afaec50..16c77e70 100644 --- a/backend/api/v1/modules/a76/invoices/schemas.py +++ b/backend/api/v1/modules/a76/invoices/schemas.py @@ -9,7 +9,7 @@ from .models import OperationType class InvoiceHeaderBase(BaseModel): """Base fields for Invoice Header""" system: Optional[str] = Field( - None, max_length=10, description="System of origin") + None, max_length=12, description="System of origin") operation_type: Optional[OperationType] = Field( None, max_length=10, description="Operation type: imp/exp/sm/ctm") invoice_type: Optional[str] = Field( diff --git a/backend/api/v1/modules/a76/items/models.py b/backend/api/v1/modules/a76/items/models.py index df310160..eb9c57a4 100644 --- a/backend/api/v1/modules/a76/items/models.py +++ b/backend/api/v1/modules/a76/items/models.py @@ -28,14 +28,9 @@ class Item(Base, TenantScopedMixin, TimestampMixin): } id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) - invoice_id: Mapped[int] = mapped_column(ForeignKey("a76.invoice_header.id")) # CONSECUTIVO - # Type: IMPORT_TEMP, IMPORT_DEF, EXPORT, REPAIR, etc. - item_type: Mapped[str] = mapped_column(String(20)) - system_origin: Mapped[str] = mapped_column(String(10)) # SCAF or SCAII + invoice_id: Mapped[int] = mapped_column(ForeignKey("a76.invoice_header.id")) # CONSECUTIVO # Item references - invoice_number: Mapped[Optional[str]] = mapped_column( - String(15)) # FACTURAIMPO/FACTURAEXPO reference_number: Mapped[Optional[str]] = mapped_column( String(20)) # NUMREFERENCIA order: Mapped[Optional[str]] = mapped_column( @@ -44,8 +39,6 @@ class Item(Base, TenantScopedMixin, TimestampMixin): String(50)) # NUMEROGUIA/NUMERODEGUIA # Dates - invoice_date: Mapped[Optional[int]] = mapped_column( - Integer) # FECHAFACTURA depreciation_date: Mapped[Optional[int]] = mapped_column( Integer) # FECHADEPRECIACION diff --git a/backend/api/v1/modules/a76/items/schemas.py b/backend/api/v1/modules/a76/items/schemas.py index 85fe6c2f..3503bab1 100644 --- a/backend/api/v1/modules/a76/items/schemas.py +++ b/backend/api/v1/modules/a76/items/schemas.py @@ -24,14 +24,6 @@ from .line_items.schemas import ( class ItemBase(BaseModel): """Base schema for items""" invoice_id: int = Field(..., description="Invoice ID") - item_type: str = Field(..., max_length=20, - description="Item type: IMPORT_TEMP, IMPORT_DEF, EXPORT, REPAIR") - system_origin: str = Field(..., max_length=10, - description="System origin: SCAF or SCAII") - - # Item references - invoice_number: Optional[str] = Field( - None, max_length=15, description="Invoice number") reference_number: Optional[str] = Field( None, max_length=20, description="Reference number") order: Optional[str] = Field(None, max_length=50, description="Order") @@ -39,7 +31,6 @@ class ItemBase(BaseModel): None, max_length=50, description="Guide number") # Dates - invoice_date: Optional[int] = Field(None, description="Invoice date") depreciation_date: Optional[int] = Field( None, description="Depreciation date") @@ -60,10 +51,6 @@ class ItemCreate(ItemBase): class ItemUpdate(ItemBase): """Schema for updating item""" invoice_id: Optional[int] = Field(None, description="Invoice ID") - item_type: Optional[str] = Field( - None, max_length=20, description="Item type") - system_origin: Optional[str] = Field( - None, max_length=10, description="System origin") lines: Optional[list[LineItemUpdate]] = Field( None, description="List of line items to update") diff --git a/frontend/src/lib/api/dashboard/a76/invoices.ts b/frontend/src/lib/api/dashboard/a76/invoices.ts index e245f335..7dbb1c0d 100644 --- a/frontend/src/lib/api/dashboard/a76/invoices.ts +++ b/frontend/src/lib/api/dashboard/a76/invoices.ts @@ -232,10 +232,10 @@ export interface InvoiceListResponse { } export interface CreateInvoiceData { - system?: string | null; - operation_type?: OperationType | null; - invoice_type?: string | null; - invoice_number?: string | null; + system: string; + operation_type: OperationType; + invoice_type: string; + invoice_number: string; project_number?: string | null; purchase_order?: string | null; related_doc_id?: number | null; diff --git a/frontend/src/lib/api/dashboard/a76/items.ts b/frontend/src/lib/api/dashboard/a76/items.ts index 94ea69d5..2dc3e26e 100644 --- a/frontend/src/lib/api/dashboard/a76/items.ts +++ b/frontend/src/lib/api/dashboard/a76/items.ts @@ -8,14 +8,10 @@ import { api } from '$lib/api'; export interface Item { id?: number; - invoice_id: number; - item_type: string; - system_origin: string; - invoice_number?: string; + invoice_id: number; reference_number?: string; order?: string; - guide_number?: string; - invoice_date?: number; + guide_number?: string; depreciation_date?: number; rectification?: number; warehouse?: string; @@ -33,13 +29,9 @@ export interface ItemListResponse { export interface CreateItemData { invoice_id: number; - item_type: string; - system_origin: string; - invoice_number?: string; reference_number?: string; order?: string; - guide_number?: string; - invoice_date?: number; + guide_number?: string; depreciation_date?: number; rectification?: number; warehouse?: string; @@ -47,13 +39,9 @@ export interface CreateItemData { } export interface UpdateItemData { - item_type?: string; - system_origin?: string; - invoice_number?: string; reference_number?: string; order?: string; - guide_number?: string; - invoice_date?: number; + guide_number?: string; depreciation_date?: number; rectification?: boolean; warehouse?: string; diff --git a/frontend/src/lib/components/dashboard/invoices/edit/general-tab-form.svelte b/frontend/src/lib/components/dashboard/invoices/edit/general-tab-form.svelte index 5f9e640d..508208a7 100644 --- a/frontend/src/lib/components/dashboard/invoices/edit/general-tab-form.svelte +++ b/frontend/src/lib/components/dashboard/invoices/edit/general-tab-form.svelte @@ -203,8 +203,7 @@