Data model
The main entities an integration sees and the fields that link them. Every _id is a 24-character string. How the terms differ: glossary.
text
organization ── warehouse ──┐
├── stock (product × warehouse)
product ────────────────────┘
product × price list × organization ── price
customer ── order (sale-order) ── sale (trade) ── invoice ── transactionOrganization and warehouse
| Entity | References | Read |
|---|---|---|
Organization (organization) | currency_id — its accounting currency | GET /organization/get-all |
Warehouse (warehouse) | organization_id — belongs to one organization; is_main — the main warehouse | POST /warehouse/get-all |
warehouse/get-paging returns an organization object instead of organization_id.
Product, price, stock
| Entity | References | Read |
|---|---|---|
Product (product) | category, measure; organizations[] — where it is available; parent_id on a variant | POST /product/get-paging |
Price list (price) | currency_id; type — sale or income | GET /price/get-all |
| Product price | product × price_id × organization → amount | POST /price/items/get-paging |
Stock (product-warehouse) | product_id × warehouse_id, organization_id | POST /product-warehouse/get-paging |
Batch (product-stock) | product, warehouse, cost and its currency | POST /product-stock/get-paging |
A product does not belong to a single organization: the catalog is shared, while availability, prices and stock are per organization. How to read stock: stock and prices; what changes it: warehouse documents.
Customer, order, sale, transaction
| Entity | References | Read |
|---|---|---|
Customer (customer) | organization_ids, category_id | POST /customer/get-paging |
Order (sale-order) | organization_id, customer_id, price_id; on a line product_id, price_id, warehouse_id | GET /sale-order/get-by-id/{id} |
Sale (trade) | organization, customer_id, warehouse_id, price_id; order_id — the order it came from; refund_id — the original sale of a refund | GET /trade/get-by-id/{id} |
| Sale line | _id — the product, item_id — the line, warehouse | GET /trade/get-items/{id} |
Transaction (transaction) | organization_id, cashbox_id, payment_method, payment_type; customer_id, trade_id, invoice_id | POST /transaction/get-paging |
sale-orderis a customer's order,tradeis the sale itself. How one becomes the other: the sale lifecycle.- A transaction is a movement of money. On a credit sale the payment can arrive later or in parts, so count sale totals and cash movement separately.