At a Glance
Owner: Product Admin · Table:tb_credit_term· Used by: purchase orders (default per vendor) · Named payment terms —name+ day-countvalue.

Credit terms encode the supplier-payment agreement as a named record with a day count: NET 30 means payment due 30 days after invoice date; COD (value = 0) means payment on delivery. POs reference a credit term so the accounts-payable schedule has a concrete due-date target.
The entity is intentionally minimal — name, value (days), and an is_active flag. Anything richer (early-payment discounts, tiered schedules) lives in application logic, not on this record. Maintained by Product Admin; read by developers and testers on the PO and AP paths.
| Task | Where | Notes |
|---|---|---|
| Add a new term | Configuration → Master Data → Credit Term → New | Required: name; value defaults 0 (COD) |
| Deactivate a term | Toggle is_active |
Hidden from new-PO pickers; historical POs keep their term |
| Change day-count | Edit value |
New POs default to new value; historical POs already have the due date stored |
| Set default per vendor | master-data/vendor detail | App-layer; not on this record |
| Symptom / Message | Cause | Action |
|---|---|---|
| "Name already in use" | Duplicate name on a non-deleted row |
Pick a different name |
| "Value must be >= 0" | Negative day-count entered | Use 0 for COD or a positive integer |
| "Name required" | Empty name |
Add a display name (e.g. NET 30) |
| "Cannot delete — referenced by open POs" | At least one open PO uses this term | Inactivate instead |
value = 0 is the standard convention; same-day due.Source: tenant schema.
tb_credit_term| Field | Prisma Type | Nullable | Description |
|---|---|---|---|
id |
String @db.Uuid |
No | Primary key. |
name |
String @db.VarChar |
No | Display name (e.g. NET 30, COD). |
value |
Int? @db.Integer |
Yes | Days after invoice date until due (default 0). |
description |
String? @db.VarChar |
Yes | Free text. |
note |
String? @db.VarChar |
Yes | Internal note. |
is_active |
Boolean? |
Yes | Active flag. |
info, doc_version |
— | Mixed | Standard metadata. |
| Audit columns | — | Yes | created_*, updated_*, deleted_*. |
Constraints: @@unique([name, deleted_at]) map credit_term_name_u. Index on name. Reverse relation to tb_purchase_order.
name unique among non-deleted rows (DB-enforced).value >= 0; name required.credit_term_id; due date = po_date + value days.../carmen-turborepo-backend-v2/packages/prisma-shared-schema-tenant/prisma/schema.prisma — tb_credit_term (lines ~4548-4572).../carmen-turborepo-frontend/apps/web/app/(app)/configuration/credit-term/.