- Renamed LineItem interface to Item and adjusted properties accordingly. - Updated CreateItemData and UpdateItemData interfaces to reflect new structure. - Modified components to use the new Item interface, removing nested lines. - Adjusted data binding in item configuration, main data, and other related components. - Simplified item creation and editing logic by removing unnecessary nesting. - Ensured all references to line items are updated to reflect the new structure.
36 lines
1.6 KiB
Python
36 lines
1.6 KiB
Python
from typing import Optional, TYPE_CHECKING
|
|
from sqlalchemy import Integer, ForeignKey
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from core.database import Base
|
|
|
|
if TYPE_CHECKING:
|
|
from ..models import LineItem
|
|
|
|
class LineReference(Base):
|
|
"""
|
|
Reference details for line items
|
|
Consolidates all line-level data from Q and S tables
|
|
"""
|
|
__tablename__ = "item_line_references"
|
|
__table_args__ = {
|
|
"schema": "a76",
|
|
}
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
|
item_line_id: Mapped[int] = mapped_column(ForeignKey("a76.item_lines.id"))
|
|
|
|
serie_id: Mapped[Optional[int]] = mapped_column(ForeignKey("a76.item_line_series.id")) # SERIEPARTIDA
|
|
|
|
# Customer/Vendor
|
|
customer_invoice: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.clients_and_providers.id")) # CLIENTEFACTURAR
|
|
assigned_client: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.clients_and_providers.id")) # CLIENTEASIGNADO
|
|
supplier: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.clients_and_providers.id")) # PROVEEDOR
|
|
requisitioner: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.clients_and_providers.id")) # REQUISITOR
|
|
sent_to: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.clients_and_providers.id")) # ENVIADOA
|
|
|
|
# PED line reference
|
|
ped_line: Mapped[Optional[int]] = mapped_column(Integer) # LINEAPED
|
|
ro_line: Mapped[Optional[int]] = mapped_column(Integer) # LINEARO
|
|
|
|
# Relationship (one-to-one)
|
|
line: Mapped["LineItem"] = relationship(back_populates="reference") |