POs
This commit is contained in:
@@ -122,6 +122,7 @@ model InventoryItem {
|
||||
inventoryTransactions InventoryTransaction[]
|
||||
salesQuoteLines SalesQuoteLine[]
|
||||
salesOrderLines SalesOrderLine[]
|
||||
purchaseOrderLines PurchaseOrderLine[]
|
||||
}
|
||||
|
||||
model Warehouse {
|
||||
@@ -250,6 +251,7 @@ model Vendor {
|
||||
updatedAt DateTime @updatedAt
|
||||
contactEntries CrmContactEntry[]
|
||||
contacts CrmContact[]
|
||||
purchaseOrders PurchaseOrder[]
|
||||
}
|
||||
|
||||
model CrmContactEntry {
|
||||
@@ -368,3 +370,35 @@ model Shipment {
|
||||
|
||||
@@index([salesOrderId, createdAt])
|
||||
}
|
||||
|
||||
model PurchaseOrder {
|
||||
id String @id @default(cuid())
|
||||
documentNumber String @unique
|
||||
vendorId String
|
||||
status String
|
||||
issueDate DateTime
|
||||
taxPercent Float @default(0)
|
||||
freightAmount Float @default(0)
|
||||
notes String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
vendor Vendor @relation(fields: [vendorId], references: [id], onDelete: Restrict)
|
||||
lines PurchaseOrderLine[]
|
||||
}
|
||||
|
||||
model PurchaseOrderLine {
|
||||
id String @id @default(cuid())
|
||||
purchaseOrderId String
|
||||
itemId String
|
||||
description String
|
||||
quantity Int
|
||||
unitOfMeasure String
|
||||
unitCost Float
|
||||
position Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
purchaseOrder PurchaseOrder @relation(fields: [purchaseOrderId], references: [id], onDelete: Cascade)
|
||||
item InventoryItem @relation(fields: [itemId], references: [id], onDelete: Restrict)
|
||||
|
||||
@@index([purchaseOrderId, position])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user