Adding a task generated from the account balance to products

This commit is contained in:
2026-09-21 21:25:34 +03:30
parent be97a067f9
commit 17fb33b3e7
10 changed files with 700 additions and 0 deletions
+25
View File
@@ -647,6 +647,7 @@ model Product {
quoteLineItems QuoteLineItem[]
invoiceLineItems InvoiceLineItem[]
stockMovements StockMovement[]
accountingLinks ProductAccountingLink[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -1316,6 +1317,7 @@ model AccountingConnection {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
personLinks PersonAccountingLink[]
productLinks ProductAccountingLink[]
documentLogs AccountingDocumentLog[]
balanceCaches AccountingBalanceCache[]
@@ -1346,6 +1348,29 @@ model PersonAccountingLink {
@@index([connectionId])
}
/// لینک محصول CRM ↔ نام کارساخته (یا معادل) در ته‌حساب
model ProductAccountingLink {
id String @id @default(cuid())
productId String
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
connectionId String
connection AccountingConnection @relation(fields: [connectionId], references: [id], onDelete: Cascade)
/// نام کارساخته در ته‌حساب (DoListNameKarsakhte.Name)
externalName String
ayar Int?
vaznSabet Float?
/// import | manual
matchMethod String @default("import")
linkedAt DateTime @default(now())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([productId, connectionId])
@@unique([connectionId, externalName])
@@index([productId])
@@index([connectionId])
}
model AccountingDocumentLog {
id String @id @default(cuid())
connectionId String