Sales — Data model
16 tables · auto-generated from migrations-v2/*.sql — do not edit by hand.
ER diagram
%%{init: {"theme":"base","themeVariables":{"darkMode":true,"background":"#1e1e1e","primaryColor":"#2d2d30","primaryBorderColor":"#569cd6","primaryTextColor":"#d4d4d4","lineColor":"#6796c6","secondaryColor":"#3a3d41","secondaryBorderColor":"#dcdcaa","secondaryTextColor":"#d4d4d4","tertiaryColor":"#252526","tertiaryBorderColor":"#569cd6","noteBkgColor":"#3a3d41","noteTextColor":"#dcdcaa","clusterBkg":"#252526","clusterBorder":"#569cd6","titleColor":"#569cd6","attributeBackgroundColorOdd":"#252526","attributeBackgroundColorEven":"#2d2d30"},"er":{"useMaxWidth":false}}}%%
erDiagram
SALES_BACKORDER {
integer id PK
text company_id FK
integer source_delivery_id FK
integer sales_order_id FK
integer sales_order_line_id FK
integer item_id FK
integer location_id FK
numeric qty_backordered
}
SALES_CREDIT_NOTE {
integer id PK
text company_id FK
integer customer_party_id FK
integer origin_invoice_id FK
integer sales_return_id FK
integer kernel_document_id FK
text doc_no
integer docstatus
}
SALES_CREDIT_NOTE_LINE {
integer id PK
text company_id FK
integer credit_note_id FK
integer invoice_line_id FK
integer sales_return_line_id FK
integer item_id FK
integer line_no
numeric qty_credited
}
SALES_DELIVERY {
integer id PK
text company_id FK
integer customer_party_id FK
integer sales_order_id FK
integer backorder_parent_id FK
integer kernel_document_id FK
text doc_no
integer docstatus
}
SALES_DELIVERY_LINE {
integer id PK
text company_id FK
integer delivery_id FK
integer sales_order_line_id FK
integer item_id FK
integer item_variant_id FK
integer location_id FK
integer line_no
}
SALES_INVOICE {
integer id PK
text company_id FK
integer customer_party_id FK
integer sales_order_id FK
integer delivery_id FK
integer kernel_document_id FK
text doc_no
integer docstatus
}
SALES_INVOICE_LINE {
integer id PK
text company_id FK
integer sales_invoice_id FK
integer sales_order_line_id FK
integer delivery_line_id FK
integer item_id FK
integer item_variant_id FK
integer line_no
}
SALES_ORDER {
integer id PK
text company_id FK
integer customer_party_id FK
integer price_list_id FK
text doc_no
integer docstatus
text status
text currency_code
}
SALES_ORDER_LINE {
integer id PK
text company_id FK
integer sales_order_id FK
integer item_id FK
integer item_variant_id FK
integer location_id FK
integer line_no
numeric qty_ordered
}
SALES_PRICE_LIST {
integer id PK
text company_id FK
text code
text name
text currency_code
text customer_tier
text valid_from
text valid_to
}
SALES_PRICE_LIST_RATE {
integer id PK
text company_id FK
integer price_list_id FK
integer item_id FK
text uom_code
numeric min_qty
numeric rate
text valid_from
}
SALES_QUOTATION {
integer id PK
text company_id FK
integer customer_party_id FK
integer price_list_id FK
integer converted_sales_order_id FK
text doc_no
integer docstatus
text status
}
SALES_QUOTATION_LINE {
integer id PK
text company_id FK
integer quotation_id FK
integer item_id FK
integer item_variant_id FK
integer location_id FK
integer price_list_rate_id FK
integer line_no
}
SALES_RESERVATION_ENTRY {
integer id PK
text company_id FK
integer sales_order_id FK
integer sales_order_line_id FK
integer source_delivery_id FK
integer item_id FK
integer item_variant_id FK
integer location_id FK
}
SALES_RETURN {
integer id PK
text company_id FK
integer customer_party_id FK
integer sales_order_id FK
integer delivery_id FK
integer kernel_document_id FK
text doc_no
integer docstatus
}
SALES_RETURN_LINE {
integer id PK
text company_id FK
integer sales_return_id FK
integer delivery_line_id FK
integer sales_order_line_id FK
integer item_id FK
integer item_variant_id FK
integer location_id FK
}
SALES_DELIVERY ||--o{ SALES_BACKORDER : source_delivery
SALES_ORDER ||--o{ SALES_BACKORDER : sales_order
SALES_ORDER_LINE ||--o{ SALES_BACKORDER : sales_order_line
SALES_INVOICE ||--o{ SALES_CREDIT_NOTE : origin_invoice
SALES_RETURN ||--o{ SALES_CREDIT_NOTE : sales_return
SALES_CREDIT_NOTE ||--o{ SALES_CREDIT_NOTE_LINE : credit_note
SALES_INVOICE_LINE ||--o{ SALES_CREDIT_NOTE_LINE : invoice_line
SALES_RETURN_LINE ||--o{ SALES_CREDIT_NOTE_LINE : sales_return_line
SALES_ORDER ||--o{ SALES_DELIVERY : sales_order
SALES_DELIVERY ||--o{ SALES_DELIVERY : backorder_parent
SALES_DELIVERY ||--o{ SALES_DELIVERY_LINE : delivery
SALES_ORDER_LINE ||--o{ SALES_DELIVERY_LINE : sales_order_line
SALES_ORDER ||--o{ SALES_INVOICE : sales_order
SALES_DELIVERY ||--o{ SALES_INVOICE : delivery
SALES_INVOICE ||--o{ SALES_INVOICE_LINE : sales_invoice
SALES_ORDER_LINE ||--o{ SALES_INVOICE_LINE : sales_order_line
SALES_DELIVERY_LINE ||--o{ SALES_INVOICE_LINE : delivery_line
SALES_PRICE_LIST ||--o{ SALES_ORDER : price_list
SALES_ORDER ||--o{ SALES_ORDER_LINE : sales_order
SALES_PRICE_LIST ||--o{ SALES_PRICE_LIST_RATE : price_list
SALES_PRICE_LIST ||--o{ SALES_QUOTATION : price_list
SALES_ORDER ||--o{ SALES_QUOTATION : converted_sales_order
SALES_QUOTATION ||--o{ SALES_QUOTATION_LINE : quotation
SALES_PRICE_LIST_RATE ||--o{ SALES_QUOTATION_LINE : price_list_rate
SALES_ORDER ||--o{ SALES_RESERVATION_ENTRY : sales_order
SALES_ORDER_LINE ||--o{ SALES_RESERVATION_ENTRY : sales_order_line
SALES_DELIVERY ||--o{ SALES_RESERVATION_ENTRY : source_delivery
SALES_ORDER ||--o{ SALES_RETURN : sales_order
SALES_DELIVERY ||--o{ SALES_RETURN : delivery
SALES_RETURN ||--o{ SALES_RETURN_LINE : sales_return
SALES_DELIVERY_LINE ||--o{ SALES_RETURN_LINE : delivery_line
SALES_ORDER_LINE ||--o{ SALES_RETURN_LINE : sales_order_line
Cross-module references
SALES_BACKORDER.company_id → COMPANY (core)
SALES_BACKORDER.item_id → ITEM (core)
SALES_BACKORDER.location_id → LOCATION (core)
SALES_CREDIT_NOTE.company_id → COMPANY (core)
SALES_CREDIT_NOTE.customer_party_id → PARTY (core)
SALES_CREDIT_NOTE.kernel_document_id → DOCUMENT (core)
SALES_CREDIT_NOTE_LINE.company_id → COMPANY (core)
SALES_CREDIT_NOTE_LINE.item_id → ITEM (core)
SALES_DELIVERY.company_id → COMPANY (core)
SALES_DELIVERY.customer_party_id → PARTY (core)
SALES_DELIVERY.kernel_document_id → DOCUMENT (core)
SALES_DELIVERY_LINE.company_id → COMPANY (core)
SALES_DELIVERY_LINE.item_id → ITEM (core)
SALES_DELIVERY_LINE.item_variant_id → ITEM_VARIANT (core)
SALES_DELIVERY_LINE.location_id → LOCATION (core)
SALES_INVOICE.company_id → COMPANY (core)
SALES_INVOICE.customer_party_id → PARTY (core)
SALES_INVOICE.kernel_document_id → DOCUMENT (core)
SALES_INVOICE_LINE.company_id → COMPANY (core)
SALES_INVOICE_LINE.item_id → ITEM (core)
SALES_INVOICE_LINE.item_variant_id → ITEM_VARIANT (core)
SALES_ORDER.company_id → COMPANY (core)
SALES_ORDER.customer_party_id → PARTY (core)
SALES_ORDER_LINE.company_id → COMPANY (core)
SALES_ORDER_LINE.item_id → ITEM (core)
SALES_ORDER_LINE.item_variant_id → ITEM_VARIANT (core)
SALES_ORDER_LINE.location_id → LOCATION (core)
SALES_PRICE_LIST.company_id → COMPANY (core)
SALES_PRICE_LIST_RATE.company_id → COMPANY (core)
SALES_PRICE_LIST_RATE.item_id → ITEM (core)
SALES_QUOTATION.company_id → COMPANY (core)
SALES_QUOTATION.customer_party_id → PARTY (core)
SALES_QUOTATION_LINE.company_id → COMPANY (core)
SALES_QUOTATION_LINE.item_id → ITEM (core)
SALES_QUOTATION_LINE.item_variant_id → ITEM_VARIANT (core)
SALES_QUOTATION_LINE.location_id → LOCATION (core)
SALES_RESERVATION_ENTRY.company_id → COMPANY (core)
SALES_RESERVATION_ENTRY.item_id → ITEM (core)
SALES_RESERVATION_ENTRY.item_variant_id → ITEM_VARIANT (core)
SALES_RESERVATION_ENTRY.location_id → LOCATION (core)
SALES_RETURN.company_id → COMPANY (core)
SALES_RETURN.customer_party_id → PARTY (core)
SALES_RETURN.kernel_document_id → DOCUMENT (core)
SALES_RETURN_LINE.company_id → COMPANY (core)
SALES_RETURN_LINE.item_id → ITEM (core)
SALES_RETURN_LINE.item_variant_id → ITEM_VARIANT (core)
SALES_RETURN_LINE.location_id → LOCATION (core)
Data dictionary
erp_sales_backorder · 10 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| source_delivery_id |
integer |
FK |
erp_sales_delivery |
| sales_order_id |
integer |
FK |
erp_sales_order |
| sales_order_line_id |
integer |
FK |
erp_sales_order_line |
| item_id |
integer |
FK |
erp_item |
| location_id |
integer |
FK |
erp_location |
| qty_backordered |
numeric |
|
|
| status |
text |
|
|
| created_at |
integer |
|
|
erp_sales_credit_note · 17 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| doc_no |
text |
|
|
| docstatus |
integer |
|
|
| status |
text |
|
|
| customer_party_id |
integer |
FK |
erp_party |
| origin_invoice_id |
integer |
FK |
erp_sales_invoice |
| sales_return_id |
integer |
FK |
erp_sales_return |
| posting_date |
text |
|
|
| currency_code |
text |
|
|
| vat_rate |
numeric |
|
|
| reason_code |
text |
|
|
| kernel_document_id |
integer |
FK |
erp_document |
| custom_fields |
text |
|
|
| created_at |
integer |
|
|
| updated_at |
integer |
|
|
| submitted_at |
integer |
|
|
erp_sales_credit_note_line · 13 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| credit_note_id |
integer |
FK |
erp_sales_credit_note |
| line_no |
integer |
|
|
| invoice_line_id |
integer |
FK |
erp_sales_invoice_line |
| sales_return_line_id |
integer |
FK |
erp_sales_return_line |
| item_id |
integer |
FK |
erp_item |
| qty_credited |
numeric |
|
|
| uom_code |
text |
|
|
| unit_price |
numeric |
|
|
| tax_code |
text |
|
|
| custom_fields |
text |
|
|
| created_at |
integer |
|
|
erp_sales_delivery · 18 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| doc_no |
text |
|
|
| docstatus |
integer |
|
|
| status |
text |
|
|
| customer_party_id |
integer |
FK |
erp_party |
| sales_order_id |
integer |
FK |
erp_sales_order |
| backorder_parent_id |
integer |
FK |
erp_sales_delivery |
| backorder_policy |
text |
|
|
| posting_date |
text |
|
|
| kernel_document_id |
integer |
FK |
erp_document |
| carrier_code |
text |
|
|
| tracking_no |
text |
|
|
| custom_fields |
text |
|
|
| created_at |
integer |
|
|
| updated_at |
integer |
|
|
| submitted_at |
integer |
|
|
| cancelled_at |
integer |
|
|
erp_sales_delivery_line · 12 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| delivery_id |
integer |
FK |
erp_sales_delivery |
| line_no |
integer |
|
|
| sales_order_line_id |
integer |
FK |
erp_sales_order_line |
| item_id |
integer |
FK |
erp_item |
| item_variant_id |
integer |
FK |
erp_item_variant |
| location_id |
integer |
FK |
erp_location |
| qty_delivered |
numeric |
|
|
| uom_code |
text |
|
|
| custom_fields |
text |
|
|
| created_at |
integer |
|
|
erp_sales_invoice · 17 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| doc_no |
text |
|
|
| docstatus |
integer |
|
|
| status |
text |
|
|
| customer_party_id |
integer |
FK |
erp_party |
| sales_order_id |
integer |
FK |
erp_sales_order |
| delivery_id |
integer |
FK |
erp_sales_delivery |
| posting_date |
text |
|
|
| currency_code |
text |
|
|
| vat_rate |
numeric |
|
|
| kernel_document_id |
integer |
FK |
erp_document |
| custom_fields |
text |
|
|
| created_at |
integer |
|
|
| updated_at |
integer |
|
|
| submitted_at |
integer |
|
|
| cancelled_at |
integer |
|
|
erp_sales_invoice_line · 14 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| sales_invoice_id |
integer |
FK |
erp_sales_invoice |
| line_no |
integer |
|
|
| sales_order_line_id |
integer |
FK |
erp_sales_order_line |
| delivery_line_id |
integer |
FK |
erp_sales_delivery_line |
| item_id |
integer |
FK |
erp_item |
| item_variant_id |
integer |
FK |
erp_item_variant |
| qty_invoiced |
numeric |
|
|
| uom_code |
text |
|
|
| unit_price |
numeric |
|
|
| tax_code |
text |
|
|
| custom_fields |
text |
|
|
| created_at |
integer |
|
|
erp_sales_order · 17 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| doc_no |
text |
|
|
| docstatus |
integer |
|
|
| status |
text |
|
|
| customer_party_id |
integer |
FK |
erp_party |
| currency_code |
text |
|
|
| price_list_id |
integer |
FK |
erp_sales_price_list |
| requested_date |
text |
|
|
| promised_date |
text |
|
|
| origin_ref |
text |
|
|
| hold_reason |
text |
|
|
| custom_fields |
text |
|
|
| created_at |
integer |
|
|
| updated_at |
integer |
|
|
| submitted_at |
integer |
|
|
| cancelled_at |
integer |
|
|
erp_sales_order_line · 15 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| sales_order_id |
integer |
FK |
erp_sales_order |
| line_no |
integer |
|
|
| item_id |
integer |
FK |
erp_item |
| item_variant_id |
integer |
FK |
erp_item_variant |
| location_id |
integer |
FK |
erp_location |
| qty_ordered |
numeric |
|
|
| uom_code |
text |
|
|
| unit_price |
numeric |
|
|
| tax_code |
text |
|
|
| reservation_policy |
text |
|
|
| tolerance_pct |
numeric |
|
|
| custom_fields |
text |
|
|
| created_at |
integer |
|
|
erp_sales_price_list · 11 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| code |
text |
|
|
| name |
text |
|
|
| currency_code |
text |
|
|
| customer_tier |
text |
|
|
| valid_from |
text |
|
|
| valid_to |
text |
|
|
| price_basis |
text |
|
|
| is_active |
integer |
|
|
| created_at |
integer |
|
|
erp_sales_price_list_rate · 10 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| price_list_id |
integer |
FK |
erp_sales_price_list |
| item_id |
integer |
FK |
erp_item |
| uom_code |
text |
|
|
| min_qty |
numeric |
|
|
| rate |
numeric |
|
|
| valid_from |
text |
|
|
| valid_to |
text |
|
|
| created_at |
integer |
|
|
erp_sales_quotation · 14 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| doc_no |
text |
|
|
| docstatus |
integer |
|
|
| status |
text |
|
|
| customer_party_id |
integer |
FK |
erp_party |
| currency_code |
text |
|
|
| price_list_id |
integer |
FK |
erp_sales_price_list |
| validity_date |
text |
|
|
| accepted_at |
integer |
|
|
| converted_sales_order_id |
integer |
FK |
erp_sales_order |
| custom_fields |
text |
|
|
| created_at |
integer |
|
|
| updated_at |
integer |
|
|
erp_sales_quotation_line · 14 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| quotation_id |
integer |
FK |
erp_sales_quotation |
| line_no |
integer |
|
|
| item_id |
integer |
FK |
erp_item |
| item_variant_id |
integer |
FK |
erp_item_variant |
| location_id |
integer |
FK |
erp_location |
| qty_quoted |
numeric |
|
|
| uom_code |
text |
|
|
| unit_price |
numeric |
|
|
| tax_code |
text |
|
|
| price_list_rate_id |
integer |
FK |
erp_sales_price_list_rate |
| custom_fields |
text |
|
|
| created_at |
integer |
|
|
erp_sales_reservation_entry · 14 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| sales_order_id |
integer |
FK |
erp_sales_order |
| sales_order_line_id |
integer |
FK |
erp_sales_order_line |
| source_delivery_id |
integer |
FK |
erp_sales_delivery |
| item_id |
integer |
FK |
erp_item |
| item_variant_id |
integer |
FK |
erp_item_variant |
| location_id |
integer |
FK |
erp_location |
| reservation_kind |
text |
|
|
| qty_delta |
numeric |
|
|
| status |
text |
|
|
| expires_at |
integer |
|
|
| created_at |
integer |
|
|
| origin_ref |
text |
|
|
erp_sales_return · 15 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| doc_no |
text |
|
|
| docstatus |
integer |
|
|
| status |
text |
|
|
| customer_party_id |
integer |
FK |
erp_party |
| sales_order_id |
integer |
FK |
erp_sales_order |
| delivery_id |
integer |
FK |
erp_sales_delivery |
| posting_date |
text |
|
|
| kernel_document_id |
integer |
FK |
erp_document |
| reason_code |
text |
|
|
| custom_fields |
text |
|
|
| created_at |
integer |
|
|
| updated_at |
integer |
|
|
| submitted_at |
integer |
|
|
erp_sales_return_line · 14 cols
| column |
type |
key |
references |
| id |
integer |
PK |
|
| company_id |
text |
FK |
erp_company |
| sales_return_id |
integer |
FK |
erp_sales_return |
| line_no |
integer |
|
|
| delivery_line_id |
integer |
FK |
erp_sales_delivery_line |
| sales_order_line_id |
integer |
FK |
erp_sales_order_line |
| item_id |
integer |
FK |
erp_item |
| item_variant_id |
integer |
FK |
erp_item_variant |
| location_id |
integer |
FK |
erp_location |
| qty_returned |
numeric |
|
|
| uom_code |
text |
|
|
| original_unit_cost |
numeric |
|
|
| custom_fields |
text |
|
|
| created_at |
integer |
|
|