Configuration of stock queries

This configuration screen is only available for Headquarters and Retail Directors roles.

Introduction

The configuration of stock queries is a key element in Onestock projects, since these queries are responsible for all the stock calculations performed during the life of the project.

These stock queries are used to pre-fill the parameters passed to the GET/stock_export API route (documentation here). Once the requests are configured, only the "request_name" field in the body is needed to apply all the parameters. This is useful in the API call, but also in most backoffice configurations (orchestration, delivery promise), since only the request name needs to be filled in instead of the whole body.

The configuration screen of stock queries is available in the Configuration tab at the bottom of the menu, and then in the Stock Queries section.

You will be shown a list of stock queries already configured on the project.

As you see, there are 3 different sections : Stocks, Items, Stock locations.

The stock queries we use in Onestock for stock calculation are those listed in the Stocks section. Items and Stocks locations sections are only used to feed stock queries.

Here's a diagram to help you understand how to build a stock request.

Understanding inheritance

As you can see, the list of queries appears as a tree. To avoid having to rewrite the entire query each time, you can decide to inherit it from an existing query. All inherited parameters already apply, and you can override them with additional parameters if you wish.

When viewing a query, you can choose whether to display inherited parameters or only those that are overloaded.

Configuration steps

To create a new stock query, you need to follow these 3 steps.

Items queries

Click on Items queries

You first need to create an item query. It will filter on the scope of items to be taken into account in the stock result.

Stock locations queries

Click on Stock locations queries

Then you need to create a stock locations query. It will filter on the scope of stock locations to be taken into account in the stock result.

Stock queries

Click on Stock queries

Finally, you will be able to use items and stock locations queries to create stock queries.

Uses

Once stock requests have been created, here are some uses in Onestock.

  • Stock exports to the website

Full or Diff stock exports to the website can be made several times during the day. If the Onestock integration layer is in charge of this export, the file will probably be deposited in an SFTP repository. Otherwise, the export can be retrieved directly via the API route GET /stock_export.

In the below example, "export_unified_uk_full" must be created beforehand in the configuration screen.

GET /stock_export { "site_id": "cxx", "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "request_name": "export_unified_uk_full" }
  • Order orchestration

When the ruleset is created, the unified and detailed stock queries must be filled in.
The unified stock query will check whether stock is available across the entire network of stores, and the detailed stock query will check whether each store has sufficient stock to be a candidate.

In the below example, "unified_web_uk" and "detailed_web_uk" must be created beforehand in the configuration screen.

  • Delivery promise methods

When a new delivery method is created in the Delivey Promise module, the detailed stock query must be filled in. It will check whether the stores available for delivery have the stock required to validate the customer's basket.

  • The Order in Store catalog

In the Store App catalog, specific stocks queries need to be given in order to show the stock of this store (available for immediate pick-up) and the stock of the entire store network.

This configuration is not yet available in DIY from the backoffice, you need to ask your Onestock contact.

 

  • The e-reservation funnel

In the e-reservation funnel, specific stocks queries need to be given in order to check for each store whether they are able to fulfill the order or not.

This configuration is not yet available in DIY from the backoffice, you need to ask your Onestock contact.