- Updated invoice processing functions to eliminate legacy fields related to returned quantities, now relying on new balance movement and discharge records. - Adjusted various components and services to reflect changes in quantity handling, including updates to the frontend for displaying used quantities instead of returned ones. - Improved the logic for invoice total updates and validation processes to ensure consistency with the new data structure. These changes aim to streamline invoice management and improve data integrity across the application.
48 lines
2.1 KiB
Python
48 lines
2.1 KiB
Python
from decimal import Decimal
|
|
from typing import Optional
|
|
from pydantic import BaseModel, Field, ConfigDict
|
|
|
|
# ============================================================================
|
|
# LINE QUANTITY SCHEMAS
|
|
# ============================================================================
|
|
|
|
class LineQuantityBase(BaseModel):
|
|
"""Base schema for line quantities"""
|
|
# Quantities
|
|
quantity: Optional[Decimal] = Field(None, description="Main quantity (CANTIMPO/CANTEXPO/CANTIMPODEF)")
|
|
alternate_quantity: Optional[Decimal] = Field(None, description="Alternate quantity (CANTALTERNA)")
|
|
quantity_uma: Optional[Decimal] = Field(None, description="UMA quantity (CANTIMPOUMA/CANTEXPOUMA)")
|
|
auxiliary_quantity: Optional[Decimal] = Field(None, description="Auxiliary quantity (CANTIMPOAUXILIAR/CANTEXPOAUXILIAR)")
|
|
|
|
# Quantities - Special (SCAF specific)
|
|
quantity_temp_export: Optional[Decimal] = Field(None, description="Temporary export quantity (CANTEXPOTEMP)")
|
|
serial_count: Optional[int] = Field(None, description="Serial count (CANT_SERIES/CANT_SERIESDEF)")
|
|
|
|
# Weight
|
|
net_weight: Optional[Decimal] = Field(None, description="Net weight (PESONETO)")
|
|
gross_weight: Optional[Decimal] = Field(None, description="Gross weight (PESOBRUTO)")
|
|
|
|
# Packaging
|
|
package_id: Optional[int] = Field(None, description="Package ID (GBultos)")
|
|
package_quantity: Optional[int] = Field(None, description="Package quantity (CANTBULTOS)")
|
|
container_quantity: Optional[int] = Field(None, description="Container quantity (CANTBULCONT)")
|
|
container_description: Optional[str] = Field(None, max_length=40, description="Container description (DESCCONTENEDOR)")
|
|
box_count: Optional[str] = Field(None, max_length=30, description="Box count (NOCAJAS)")
|
|
|
|
|
|
class LineQuantityCreate(LineQuantityBase):
|
|
"""Schema for creating line quantity"""
|
|
pass
|
|
|
|
|
|
class LineQuantityUpdate(LineQuantityBase):
|
|
"""Schema for updating line quantity"""
|
|
pass
|
|
|
|
|
|
class LineQuantityResponse(LineQuantityBase):
|
|
"""Schema for line quantity response"""
|
|
id: int
|
|
item_line_id: int
|
|
|
|
model_config = ConfigDict(from_attributes=True) |