- Implemented the items tab form in Svelte for editing invoices, displaying item quantities and import values. - Created saveInvoice function to handle both creation and updating of invoices, including validation of required fields and building a unified payload for API requests. - Added support for compliance, financials, and logistics data in the invoice payload.
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
from typing import Optional
|
|
from pydantic import BaseModel, Field, ConfigDict
|
|
|
|
# ============================================================================
|
|
# LINE REFERENCE SCHEMAS
|
|
# ============================================================================
|
|
|
|
class LineReferenceBase(BaseModel):
|
|
"""Base schema for line references"""
|
|
serie_id: Optional[int] = Field(None, description="Serie ID (SERIEPARTIDA)")
|
|
|
|
# Customer/Vendor
|
|
customer_invoice: Optional[str] = Field(None, description="Customer invoice (CLIENTEFACTURAR)")
|
|
assigned_client: Optional[str] = Field(None, description="Assigned client (CLIENTEASIGNADO)")
|
|
supplier: Optional[str] = Field(None, description="Supplier (PROVEEDOR)")
|
|
requisitioner: Optional[str] = Field(None, description="Requisitioner (REQUISITOR)")
|
|
sent_to: Optional[str] = Field(None, description="Sent to (ENVIADOA)")
|
|
|
|
# PED line reference
|
|
ped_line: Optional[int] = Field(None, description="PED line (LINEAPED)")
|
|
ro_line: Optional[int] = Field(None, description="RO line (LINEARO)")
|
|
|
|
|
|
class LineReferenceCreate(LineReferenceBase):
|
|
"""Schema for creating line reference"""
|
|
pass
|
|
|
|
|
|
class LineReferenceUpdate(LineReferenceBase):
|
|
"""Schema for updating line reference"""
|
|
pass
|
|
|
|
|
|
class LineReferenceResponse(LineReferenceBase):
|
|
"""Schema for line reference response"""
|
|
id: int
|
|
item_line_id: int
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|