u
This commit is contained in:
34
API.order.md
34
API.order.md
@@ -40,7 +40,7 @@ const order = await store.order.create(42, { number: 'B-2026-001', date: '2026-0
|
||||
|
||||
*Source: `src/store/order/createFromQuote.js`*
|
||||
|
||||
Creates a new sales order from an existing quote for the user's selected company. Copies lines, entity, and external number from the quote unless explicitly overridden. If order number is omitted, it is auto-allocated from the 'order' number sequence.
|
||||
Creates a new sales order from an existing quote for the user's selected company. Copies lines and customer entity from the quote. Sets external reference to the quote number (quote.number) unless explicitly overridden. If order number is omitted, it is auto-allocated from the 'order' number sequence.
|
||||
|
||||
**Parameters**
|
||||
|
||||
@@ -53,7 +53,7 @@ Creates a new sales order from an existing quote for the user's selected company
|
||||
| `[body.date]` | `string` | The order date; defaults to current date if omitted. |
|
||||
| `[body.createdAt]` | `string` | Creation timestamp; defaults to current time if omitted. |
|
||||
| `[body.entityId]` | `number` | Customer entity id override; defaults to quote's entityId. |
|
||||
| `[body.externalNumber]` | `string` | Customer reference override; defaults to quote's externalNumber. |
|
||||
| `[body.externalNumber]` | `string` | Customer reference override; defaults to quote's number. |
|
||||
| `[body.lines]` | `Array<{sku?: string, name?: string, pu?: number, amount: number, net: number, rebate?: number, taxrate: number, comment?: string|null}>` | Lines override; defaults to quote's lines. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
@@ -63,7 +63,7 @@ Creates a new sales order from an existing quote for the user's selected company
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the quote is not found, or the order is invalid.
|
||||
`Error` — If the quote is not found, no entity is selected, or the order is invalid.
|
||||
|
||||
**Example**
|
||||
|
||||
@@ -72,6 +72,34 @@ const order = await store.order.createFromQuote(42, 10);
|
||||
// => { id, number, type: 'order', entityId, externalNumber, date, lines: [...] }
|
||||
```
|
||||
|
||||
## `order.createShipment`
|
||||
|
||||
*Source: `src/store/order/createShipment.js`*
|
||||
|
||||
Creates a new shipment manifest for an order. Can contain one, some, or all items from the parent order. If lines is omitted or empty, all remaining unshipped items are included.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `orderId` | `number` | The parent order manifest id. |
|
||||
| `[input]` | `object` | Optional overrides. |
|
||||
| `[input.lines]` | `Array<{sku: string, amount?: number, name?: string, pu?: number, net?: number, rebate?: number, taxrate?: number, comment?: string}>` | Positions (defaults to all remaining items). |
|
||||
| `[input.date]` | `string|Date` | Optional shipment date. |
|
||||
| `[input.externalNumber]` | `string` | Optional external delivery reference. |
|
||||
| `[tx]` | `object` | Optional transaction. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<object>` — The created shipment.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const shipment = await store.order.createShipment(googleAuthId, 10);
|
||||
```
|
||||
|
||||
## `order.delete`
|
||||
|
||||
*Source: `src/store/order/delete.js`*
|
||||
|
||||
Reference in New Issue
Block a user