- Expanded the PedimentoDates, PedimentoPayments, PedimentoTransportMeans, and PedimentoValidation interfaces to include additional fields. - Updated the dates, payments, transport, and validation tab forms to initialize form data directly from the Pedimento object, removing unnecessary API calls for data loading. - Enhanced the payload construction in the edit page to conditionally include sub-resources only if they contain values, improving data handling during creation and update operations. - Adjusted the form bindings to reflect the new structure and ensure proper data flow between the components.
68 lines
2.2 KiB
Python
68 lines
2.2 KiB
Python
from datetime import date as Date2
|
|
from datetime import time as Time2
|
|
from typing import TYPE_CHECKING
|
|
|
|
from api.v1.common.base_models import TenantScopedMixin, TimestampMixin
|
|
from core.database import Base
|
|
from sqlalchemy import (
|
|
Date,
|
|
ForeignKeyConstraint,
|
|
Index,
|
|
Integer,
|
|
PrimaryKeyConstraint,
|
|
SmallInteger,
|
|
String,
|
|
Time,
|
|
UniqueConstraint,
|
|
)
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
if TYPE_CHECKING:
|
|
from api.v1.modules.a76.pedmientos.models.pedimentos import Pedimentos
|
|
|
|
|
|
class PedimentoPayments(Base, TenantScopedMixin, TimestampMixin):
|
|
__tablename__ = "pedimento_payments"
|
|
__table_args__ = (
|
|
PrimaryKeyConstraint("id", name="pedimento_payments_pkey"),
|
|
ForeignKeyConstraint(
|
|
["tenant_id"], ["a76.tenants.id"], name="fk_pedimento_payments_tenant"
|
|
),
|
|
ForeignKeyConstraint(
|
|
["company_id"], ["a76.company.id"], name="fk_pedimento_payments_company"
|
|
),
|
|
ForeignKeyConstraint(
|
|
["pedimento_id"],
|
|
["a76.pedimentos.id"],
|
|
ondelete="CASCADE",
|
|
name="fk_pedimento_payments",
|
|
),
|
|
UniqueConstraint(
|
|
"tenant_id",
|
|
"company_id",
|
|
"pedimento_id",
|
|
name="pedimento_payments_pedimento_id_key",
|
|
),
|
|
Index("idx_pedimento_payments_pedimento_id", "pedimento_id"),
|
|
{"schema": "a76"},
|
|
)
|
|
|
|
id: Mapped[int] = mapped_column(Integer)
|
|
pedimento_id: Mapped[int] = mapped_column(Integer, nullable=False)
|
|
|
|
acknowledgment: Mapped[str] = mapped_column(String(20))
|
|
operation_number: Mapped[str] = mapped_column(String(14))
|
|
bank_code: Mapped[int] = mapped_column(Integer)
|
|
cashier: Mapped[str] = mapped_column(String(2))
|
|
date: Mapped[Date2] = mapped_column(Date)
|
|
time: Mapped[Time2] = mapped_column(Time)
|
|
shift: Mapped[str] = mapped_column(String(1))
|
|
total_cash_paid: Mapped[int] = mapped_column(Integer)
|
|
total_contributions: Mapped[int] = mapped_column(Integer)
|
|
counter_payment: Mapped[int] = mapped_column(SmallInteger)
|
|
pece_code: Mapped[str] = mapped_column(String(5))
|
|
|
|
pedimento: Mapped["Pedimentos"] = relationship(
|
|
"Pedimentos", back_populates="pedimento_payments"
|
|
)
|