Se esta disenando mejor la parte de partes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from decimal import Decimal
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
from sqlalchemy import Boolean, String, Integer, Numeric, SmallInteger, ForeignKey
|
||||
from sqlalchemy import Boolean, String, Integer, Numeric, SmallInteger, ForeignKey, ForeignKeyConstraint
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
from api.v1.common.base_models import TenantScopedMixin, TimestampMixin
|
||||
from core.database import Base
|
||||
@@ -25,9 +25,14 @@ class LineItem(Base, TenantScopedMixin, TimestampMixin):
|
||||
"""
|
||||
|
||||
__tablename__ = "item_lines"
|
||||
__table_args__ = {
|
||||
"schema": "a76",
|
||||
}
|
||||
__table_args__ = (
|
||||
ForeignKeyConstraint(
|
||||
["class_code", "tenant_id", "company_id"],
|
||||
["a76.classes.class_code", "a76.classes.tenant_id", "a76.classes.company_id"],
|
||||
name="fk_item_lines_class"
|
||||
),
|
||||
{"schema": "a76"},
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
||||
item_id: Mapped[int] = mapped_column(ForeignKey("a76.items.id"))
|
||||
@@ -40,9 +45,7 @@ class LineItem(Base, TenantScopedMixin, TimestampMixin):
|
||||
component_part_number: Mapped[Optional[str]] = mapped_column(
|
||||
ForeignKey("a76.parts.id")
|
||||
) # NUMPARTECOM
|
||||
class_code: Mapped[Optional[str]] = mapped_column(
|
||||
ForeignKey("a76.classes.class_code")
|
||||
) # CLASE
|
||||
class_code: Mapped[Optional[str]] = mapped_column(String(8)) # CLASE
|
||||
|
||||
# Unit of measure
|
||||
unit_of_measure: Mapped[Optional[str]] = mapped_column(
|
||||
|
||||
Reference in New Issue
Block a user