# Inventory

### Overview

Inventory synchronization is **bidirectional**, but the direction for each store is determined by the **stock master** configuration. Each store can independently designate either Omnium or Flow as its authoritative source for stock levels.

### Stock master concept

| Configuration              | Direction     | Behavior                                                                                                     |
| -------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------ |
| **Omnium is stock master** | Omnium → Flow | Omnium pushes stock levels to Flow. Flow does not send inventory updates back.                               |
| **Flow is stock master**   | Flow → Omnium | Flow pushes stock levels to Omnium after goods reception. Omnium does not push stock to Flow for this store. |

The stock master is configured per store in Flow using the extension setting `OMNIUM_FLOW_STOCK_MASTER`:

* `true` — Flow is the stock master
* `false` (default) — Omnium is the stock master

### Omnium → Flow (Omnium is stock master)

When Omnium is the stock master, inventory levels are pushed from Omnium to Flow through Omnium's `IInventoryExporter` interface.

#### Sync process

1. Products with modified inventory since the last sync are identified
2. For each market (or market group), corresponding Flow stores are resolved
3. Inventory levels are transmitted to each Flow store
4. Cost price data is optionally included

#### Scheduled task configuration

The inventory export runs on a schedule using delta synchronization — only products with inventory changes since the last execution are processed:

```json
{
  "schedule": "*/30 * * * *",
  "implementationType": "FlowInventoryScheduledTask",
  "isDisabled": false
}
```

This example runs every 30 minutes.

### Flow → Omnium (Flow is stock master)

When Flow is the stock master, stock levels are pushed to Omnium after goods are received in Flow. This is handled by the **receivement sync engine**.

#### Sync process

1. A goods reception is completed in Flow (items received against a purchase order)
2. A receivement sync job is added to the queue
3. The sync engine processes the job:
   * If the purchase order exists in Omnium, it sends a **goods reception confirmation** with received quantities
   * If the purchase order does not exist in Omnium (e.g., a local PO), it sends an **inventory level update** instead

#### Inventory update payload

When sending inventory updates to Omnium, Flow sends the current stock level per SKU and warehouse:

| Field           | Description                                                 |
| --------------- | ----------------------------------------------------------- |
| `sku`           | Product SKU                                                 |
| `warehouseCode` | Flow warehouse UID                                          |
| `inventory`     | Current stock quantity (converted to Omnium's float format) |

#### Quantity difference detection

Before sending goods reception confirmations, the sync engine compares Flow's received quantities with Omnium's current quantities. If there is no difference, the sync is skipped to avoid unnecessary API calls.

### Configuration reference

| Setting                             | Description                                 | Default |
| ----------------------------------- | ------------------------------------------- | ------- |
| `OMNIUM_FLOW_STOCK_MASTER`          | Store-level setting: Flow is stock master   | `false` |
| `OmniumIsMasterForStock`            | Omnium connector: Omnium is stock authority | `false` |
| `UseCostPriceListInInventoryExport` | Include cost prices in inventory export     | `false` |
| `FlowWebWarehouse`                  | UID of the web/online warehouse in Flow     | Not set |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flowretail.com/docs/integrations/order-management/omnium-oms-integration/inventory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
