- 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.
47 lines
2.1 KiB
Python
47 lines
2.1 KiB
Python
from typing import Optional
|
|
from pydantic import BaseModel, Field, ConfigDict
|
|
|
|
# ============================================================================
|
|
# LINE DESCRIPTION SCHEMAS
|
|
# ============================================================================
|
|
|
|
class LineDescriptionBase(BaseModel):
|
|
"""Base schema for line descriptions"""
|
|
# Descriptions
|
|
description_spanish: Optional[str] = Field(None, max_length=4999, description="Description in Spanish (DESCRIPCIONE)")
|
|
description_english: Optional[str] = Field(None, max_length=4999, description="Description in English (DESCRIPCIONI)")
|
|
extra_description: Optional[str] = Field(None, description="Extra description (DESCRIPCIONEEXTRA)")
|
|
part_description: Optional[str] = Field(None, max_length=500, description="Part description (DESCRIPCIONPARTE)")
|
|
class_description: Optional[str] = Field(None, max_length=500, description="Class description (DESCRIPCIONCLASE)")
|
|
|
|
# Product attributes
|
|
brand: Optional[str] = Field(None, max_length=50, description="Brand (MARCA)")
|
|
model: Optional[str] = Field(None, max_length=50, description="Model (MODELO)")
|
|
has_serial: Optional[bool] = Field(None, description="Has serial (LLEVASERIE)")
|
|
|
|
# Additional information
|
|
additional_info_spanish: Optional[str] = Field(None, max_length=1000, description="Additional info in Spanish (INFOADICIONESP)")
|
|
additional_info_english: Optional[str] = Field(None, max_length=1000, description="Additional info in English (INFOADICIONING)")
|
|
|
|
# Lot and entry tracking
|
|
lot: Optional[str] = Field(None, max_length=254, description="Lot (LOTE)")
|
|
entry_number: Optional[str] = Field(None, max_length=50, description="Entry number (NUMENTRADA/NUMERODEENTRADA)")
|
|
|
|
|
|
class LineDescriptionCreate(LineDescriptionBase):
|
|
"""Schema for creating line description"""
|
|
pass
|
|
|
|
|
|
class LineDescriptionUpdate(LineDescriptionBase):
|
|
"""Schema for updating line description"""
|
|
pass
|
|
|
|
|
|
class LineDescriptionResponse(LineDescriptionBase):
|
|
"""Schema for line description response"""
|
|
id: int
|
|
item_line_id: int
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|