# Sales orders and delivery notes

> Confirm an order, deliver part of it on a delivery note, invoice the delivered lines, take goods back and undo a return, mark invoices shipped.

Source: /help/en/documents/sales-orders-and-delivery-notes

An order confirmation is your sales order: once the buyer accepts it, its lines are delivered on delivery notes and invoiced in parts. The order shows, per line, what was ordered, delivered and invoiced, and its fulfilment follows from those numbers. A delivery note moves the goods out of stock when it is marked delivered; a return brings them back; every state change is a row you can undo.

## A worked example

Golden Trading confirms an order of three lines: 10 steel brackets, 5 copper pipes and a fitting service.

1. **Documents → Order Confirmations → New order confirmation**: pick the buyer, add the three lines, **Save**, then **More** → **Mark accepted** (or from the row menu). The order's badge reads **Open**.
2. **More** → **Create delivery note** on the order page: tick the brackets and the pipes, keep the quantities, set the delivery date and switch **Mark delivered now** on → **Create delivery note**. The note opens as **Delivered**: 10 brackets and 5 pipes left the stock at their current cost, and with the inventory module on the Ledger card shows the cost of goods on the note's own entry (Dr cost of sales / Cr inventory). The order now reads **Partly delivered**; line 3 is still open.
3. **More** → **Invoice selected lines** on the order: the two delivered lines are ticked with their open quantities → **Create draft invoice**. The draft carries the order number in **Order reference** (BT-13) and the delivery note's number in **Despatch advice** (BT-16). Validate it as usual: it posts revenue and VAT, and no cost leg, because the goods and their cost left with the delivery note. The order reads **Partly invoiced**; the fulfilment card lists the note and the invoice.
4. The buyer sends the brackets and pipes back. On the delivery note, **More** → **Mark returned**: the goods come back into stock at the cost they left at and the entry is mirrored. The events card shows **Delivered** and **Returned**.
5. It was a mistake. On the Returned row, **Undo** with a reason: a **Reversal** row is added, the return's movements and entry are reversed, and the note reads **Delivered** again. Nothing was edited; the card shows all three rows.
6. A second order the buyer withdraws: from the row menu, **Cancel**, type the reason → **Cancel document**. The order keeps its number, reads **Cancelled**, and the document trail records who cancelled it and why.

## Fulfilment

The fulfilment badge of an order confirmation is derived from its lines, never typed:

- **Open**: nothing delivered or invoiced yet.
- **Partly delivered** and **Delivered**: delivery notes marked delivered cover some or every line.
- **Partly invoiced** and **Invoiced**: invoices whose lines name the order lines cover some or every line.
- **Closed**: every line delivered and invoiced.

The card under the editor shows ordered, delivered, invoiced, to deliver and to invoice per line, with the delivery notes (and their state) and the invoices linked. The REST route `GET /orders/{id}/fulfilment` and the assistant tool `get_order_fulfilment` answer the same figures.

Once a line is delivered or invoiced the order's lines are frozen: the head (dates, texts, references) still saves, a changed line is refused with `order_in_fulfilment`. Cancel the order and create a new one when the lines must change.

## Sub-statuses

Beside the lifecycle status you can keep your own states ("awaiting stock", "ready to ship"). Under **Settings → Documents → Sub-statuses** add one per document kind; then on the list, the row menu's **Set sub-status** puts it on the row, the chip shows beside the status and the sub-status filter next to the status chips narrows the list. The API lists documents by `?substatus=` and sets it with `POST /documents/{id}/substatus`.

## Cancelling

**Cancel** sits on the row menu of quotes and order confirmations and under **More** on the page of a document that is not converted. It asks for a reason, keeps the number and marks the document **Cancelled**. An order with delivered goods or an issued invoice linked cannot be cancelled: return or undo the delivery and unlink the invoice first. A delivery note is cancelled (**More** → **Cancel note** on its page) only while it is open with no events.

## Linking an invoice to an order

An invoice created by hand can be mapped to an order afterwards: on the invoice page, **More** → **Link to order** → pick the accepted order confirmation → **Link**. The order's own reference (or its number) is written into the invoice's **Order reference** (BT-13) and the order's fulfilment card lists the invoice. **More** → **Unlink from order** clears it again; an order the invoice had converted goes back to **Accepted**. The invoice's lines are not touched by the link; the quantities per line come from **Invoice selected lines** and **Convert to tax invoice**.

## Partial invoicing

**More** → **Invoice selected lines** on an accepted order opens the lines with their open quantities. Tick the lines, change the quantities (never more than what is open: `quantity_exceeds_open`), drag the rows into the order you want on the invoice and **Create draft invoice**. The draft is linked to the order, carries BT-13 and BT-16, and the order's invoiced quantities follow the invoice's lines. **Convert to tax invoice** still invoices the whole order in one step.

## Delivery notes and packing slips

**Documents → Delivery Notes** lists every note with its state: **Open**, **Delivered**, **Returned**, **Undelivered** or **Cancelled**. A note starts from its order (**Create delivery note**) and takes the order line's item, description and price; **Mark delivered now** records the delivery at once, otherwise mark it from the note's page when the goods leave.

- **Mark delivered** (from Open or Undelivered): every tracked line leaves the stock at the current cost; with the inventory module on, the cost of goods delivered posts on the note's own entry (module Orders and delivery, reference `delivery:<note>:<event>`). The entry is previewed first; **Confirm** applies it. A note in a locked period can be proposed to the owner instead.
- **More** → **Mark returned** (from Delivered): the goods come back at the cost they left at and the entry is mirrored.
- **More** → **Mark undelivered** (from Open): nothing moves; the note stays open to try again.
- **Undo** on the latest event: a reversal row, the movements and the entry reversed. An undone event stays in the list, struck through, with its reversal beneath.

**Preview** prints the delivery note with prices and the shipment panel (order, delivery date and any shipment fields such as the carrier or the tracking number kept in the note's custom fields). **More** → **Packing slip** prints the same note without prices, with a column to tick on receipt and a signature line. **More** → **E-mail** sends it to the recipient with the Delivery note template (**Settings → Documents → Email templates**).

The note's header keeps **Preview** and, while the note is open or undelivered, **Mark delivered**. The page shows the details, the lines and all its cards (ledger, delivery events, attachments, comments, history) one above the other; select **Tabs** in the header to see the cards as icon tabs instead, and **All in one** to switch back (the choice is remembered in this browser for every document page).

The numbers come from the `delivery_note` series (`DLV-{n}`, **Settings → Documents → Numbering**).

## Shipped invoices

On an issued invoice, **More** → **Mark shipped** records that the goods went out; **More** → **Mark unshipped** takes it back. On the invoice list, tick several invoices and use the same two actions in the bulk bar. The audit log carries `invoice.shipped` and `invoice.unshipped` with who and when.

## Through the API and the assistant

- REST: `POST /documents`, `PUT /documents/{id}`, `POST /documents/{id}/status`, `POST /documents/{id}/cancel`, `POST /documents/{id}/convert`, `POST /documents/{id}/substatus`, `GET /orders/{id}/fulfilment`, `POST /orders/{id}/invoice-lines`, `POST /invoices/{id}/order` and `DELETE`, `POST /invoices/{id}/shipped`, `POST /delivery-notes`, `POST /delivery-notes/{id}/events`, `POST /delivery-notes/{id}/events/{eventId}/undo`. A delivery posts an entry: send `x-preview: true` to see it first.
- Assistant tools: `save_document`, `set_document_status`, `cancel_document`, `convert_document`, `set_document_substatus`, `get_order_fulfilment`, `invoice_order_lines`, `link_invoice_to_order`, `unlink_invoice_from_order`, `create_delivery_note`, `set_delivery_state` (asks for confirmation with the entry previewed), `undo_delivery_event`, `set_invoice_shipped`.

## Related

- [Order confirmations](/help/en/documents/order-confirmations)
- [Stock valuation and purchase returns](/help/en/products/stock-valuation-and-purchase-returns)
- [Quotes](/help/en/documents/quotes)
