# SalesOrderLineStatuses

> One row per status of (part of) a sales order line in the orderflow.

Subject: Sales orders.

One row per status of (part of) a sales order line in the orderflow. An order line can be split over several open status lines, for example when part of it is delivered and the rest is not yet in stock. Every orderflow action closes the row it acts on (is_finished = true, kept as history) and opens new ones. The open rows (is_finished = false) are the current state. Which status an action leads to is configured per administration in NextStatuses.

Label in Fledge: Verkooporder statusregels.

| | |
| --- | --- |
| URL | `https://odata-api.fledge.nl/v2-8/SalesOrderLineStatuses` |
| Key | `administration_id`, `sales_order_header_id`, `sales_order_line_id`, `sales_order_line_status_id` |
| Administration-specific | yes: always filter on `administration_id` |
| Operations | GET list, GET one, POST, PATCH, DELETE |
| Read licenses | BASIS, URENPC |
| Write licenses | VERKOOP |
| Scopes | FLEDGE_PORTAL, FLEDGE_TERMINAL |

> **Watch out:** Finished rows are history: every orderflow action keeps the old row with is_finished = true. Add is_finished eq false for the current state; leave it out only when the history is what you want.

> **Watch out:** Users call both 8 and 10 "Geleverd". 8 means a delivery note was made, 10 means delivered; many administrations never use 10. Include both unless the user means one of them.

> **Watch out:** Status 2 is approval (fiat), which users call "Bevestigd". Whether an order confirmation was sent to the customer is SalesOrderHeaders.is_confirmed instead. Check which one the user means.

## Example requests

```http
GET https://odata-api.fledge.nl/v2-8/SalesOrderLineStatuses?$filter=administration_id eq 1&$select=sales_order_header_id,sales_order_line_id,sales_order_line_status_id,action,creation_date_time,delivery_note_header_id&$top=50
GET https://odata-api.fledge.nl/v2-8/SalesOrderLineStatuses(administration_id=1,sales_order_header_id='{sales_order_header_id}',sales_order_line_id={sales_order_line_id},sales_order_line_status_id={sales_order_line_status_id})
```

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `administration_id` (key) | Int32 | Administratienummer |
| `sales_order_line_id` (key) | Int32, not null | Regelnummer |
| `sales_order_header_id` (key) | String, not null | Verkoopordernummer |
| `sales_order_line_status_id` (key) | Int32, not null | Volgnummer |
| `action` | String | Acite: Is actie mogelijk. Selecting it returns action__1 up to action__30, one flag per orderflow action number, as they were when the row was made. The backend checks the current configuration instead, so a flag can be out of date. |
| `created_by` | Int32 | User aanmaak |
| `creation_date_time` | DateTimeOffset | Aangemaakt: Aanmaakdatum en -tijd. When the row was made, so when the line reached this status. Local time, except rows the Fledge API made (picklist confirmation and a reverted delivery note in the app), which are in UTC. |
| `delivery_note_line_id` | Int32 | Volgnummer |
| `delivery_note_header_id` | String | Pakbonnummer. The delivery note (pakbon) this quantity went on, set on the row the delivery made. |
| `financial_year` | Int32 | Boekjaar |
| `sales_invoice_header_id` | String | Factuur nummer. The invoice this quantity is on, together with financial_year. |
| `is_final_status` | Boolean | Eind status. True when no action at all is allowed on the row any more. Not the same as "the flow is done". |
| `is_finished` | Boolean | Afgewerkt (ja/nee). Whether this row is history. Filter on is_finished eq false for the current state. |
| `parent_status_id` | Int32 | Parent. The sales_order_line_status_id of the row this one came from; 0 on a line's first row. |
| `picklist_header_id` | String | Picklist nummer |
| `picklist_line_id` | Int32 | Volgnummer |
| `price` | Decimal | Prijs. Not reliable as a value: depending on how the line was last changed it holds the net or the gross price. For a value use quantity times SalesOrderLines.net_price_local_currency. |
| `production_order_header_id` | String | Order nummer. The production order this quantity is made in, when it has one. |
| `sales_invoice_line_id` | Int32 | Factuurregelnummer |
| `serial_number_id` | Int32 | Serienummer autom.: Serienummer automatisch |
| `sscc_label_id` | Int64 | SSCC-code id: Uniek volgnummer SSCC-code |
| `warehouse_address_id` | Int32 | Adresnummer |
| `article_id` | String | Artikelcode |
| `lot_number` | String | Lotnummer/partijregistratie |
| `quantity` | Decimal | Aantal. The part of the order line's quantity that is in this status. Only open rows count, and together they can be less than the line's quantity (a remainder can be dropped) or include negative rows. |
| `status` | Int32 | Status. Values: 1 = Created (Aangemaakt); 2 = Approved (Bevestigd, formerly Gefiatteerd); 3 = To produce (Te produceren); 4 = In production (In productie); 5 = Ordered from a supplier (In bestelling); 6 = Ready / reserved (Gereed); 7 = On picklist (Op picklist); 8 = Delivery note made (Geleverd); 9 = Ready to ship (Klaar om te leveren); 10 = Delivered (Geleverd); 11 = Invoiced (Gefactureerd); 12 = Historic (Historisch); 13 = Deleted (Verwijderd); 14 = Approved for invoicing (Bevestigd voor facturatie, formerly Gefiatteerd voor facturatie); 15 = Invoice processed (Factuur verwerkt) |
| `warehouse_aisle_id` | Int32 | Magazijn |
| `warehouse_shelf_id` | Int32 | Locatie |

## Relations

- `Administration` → [Administrations](https://docs.fledge.nl/en/api/reference/Administrations.md) (one)
- `Article` → [Articles](https://docs.fledge.nl/en/api/reference/Articles.md) (one)
- `CreatedBy` → [Users](https://docs.fledge.nl/en/api/reference/Users.md) (one)
- `DeliveryNoteHeader` → [DeliveryNoteHeaders](https://docs.fledge.nl/en/api/reference/DeliveryNoteHeaders.md) (one)
- `HistoricProductionOrderHeader` → [HistoricProductionOrderHeaders](https://docs.fledge.nl/en/api/reference/HistoricProductionOrderHeaders.md) (one)
- `PicklistHeader` → [PickListHeaders](https://docs.fledge.nl/en/api/reference/PickListHeaders.md) (one)
- `PicklistLine` → [PickListLines](https://docs.fledge.nl/en/api/reference/PickListLines.md) (one)
- `ProductionOrderHeader` → [ProductionOrderHeaders](https://docs.fledge.nl/en/api/reference/ProductionOrderHeaders.md) (one)
- `SalesInvoiceHeader` → [SalesInvoiceHeaders](https://docs.fledge.nl/en/api/reference/SalesInvoiceHeaders.md) (one)
- `SalesInvoiceLine` → [SalesInvoiceLines](https://docs.fledge.nl/en/api/reference/SalesInvoiceLines.md) (one)
- `SalesOrderHeader` → [SalesOrderHeaders](https://docs.fledge.nl/en/api/reference/SalesOrderHeaders.md) (one)
- `SalesOrderLine` → [SalesOrderLines](https://docs.fledge.nl/en/api/reference/SalesOrderLines.md) (one)
- `SerialNumber` → [SerialNumbers](https://docs.fledge.nl/en/api/reference/SerialNumbers.md) (one)
- `SsccLabel` → [SsccLabels](https://docs.fledge.nl/en/api/reference/SsccLabels.md) (one)
- `WarehouseAdress` → [WarehouseAddresses](https://docs.fledge.nl/en/api/reference/WarehouseAddresses.md) (one)
- `WarehouseAisle` → [WarehouseAisles](https://docs.fledge.nl/en/api/reference/WarehouseAisles.md) (one)
- `WarehouseShelf` → [WarehouseShelfs](https://docs.fledge.nl/en/api/reference/WarehouseShelfs.md) (one)

## Actions

- `POST SalesOrderLineStatuses(administration_id=1,sales_order_header_id='{sales_order_header_id}',sales_order_line_id={sales_order_line_id},sales_order_line_status_id={sales_order_line_status_id})/approve` — returns SalesOrderLineStatus
- `POST SalesOrderLineStatuses(administration_id=1,sales_order_header_id='{sales_order_header_id}',sales_order_line_id={sales_order_line_id},sales_order_line_status_id={sales_order_line_status_id})/approveForInvoicing` — returns SalesOrderLineStatus
- `POST SalesOrderLineStatuses/bookSalesOrderInvoice` — body: `administration_id` Int32; `invoice_date` String; `SalesOrderLineStatuses` BookSalesOrderInvoiceSalesOrderLineStatusDto[]: sales_order_header_id (String), sales_order_line_id (Int32), sales_order_line_status_id (Int32) — returns SalesInvoiceHeader
- `POST SalesOrderLineStatuses(administration_id=1,sales_order_header_id='{sales_order_header_id}',sales_order_line_id={sales_order_line_id},sales_order_line_status_id={sales_order_line_status_id})/linkToExistingAssembly` — body: `production_order_header_id` String; `production_quantity` Decimal — returns SalesOrderLineStatus

---

Source: https://docs.fledge.nl/en/api/reference/SalesOrderLineStatuses
