Stock List
Stock List consists of product stocks that store the stock information for their related products. As mentioned at “Introduction”, they are used by catalogs.
However, in some cases, a catalog can also contain extra stock lists to switch between them depending on the condition. To give an example, we can consider an app that sells from retail stores by calculating the nearest retail store to the user. In this case, you have to separate stocks by retail stores for a product and you need to use extra stock lists.
GET
Stock List
GET
Stock ListSample HTTP request to get all stock lists from the system.
‘content_type’ header represents the response type.
The ‘Authorization’ header is required for authentication. Retrieve api_token
by logging in.
Request
Path : /api/v1/stock_list/
Response
Returns all stock lists.
POST
Create Stock List
POST
Create Stock ListRecords new objects in the StockList
table. The StockListSerializer
class defined at omnitron.catalogs.resources.serializers
is used to validate the data.
‘content_type’ header represents the response type.
The ‘Authorization’ header is required for authentication. retrieve api_token
by logging in.
Request
Path: /api/v1/stock_list/
Response
The response status code will be 201
because a required field is specified.
PATCH
Update Stock List
PATCH
Update Stock ListUpdate the object specified with the primary key in the StockList
table.
‘content_type’ header represents the response type.
The ‘Authorization’ header is required for authentication. Retrieve api_token
by logging in.
Request
Path: /api/v1/stock_list/{PK}/
Response
Response status code will be 200
. Updated relevant fields will be returned because the mandatory field is specified.
POST
Bulk Create Stock Lists
POST
Bulk Create Stock ListsSample HTTP post request to create multiple stock lists at once. Make sure you have an acceptable dataset and file.
Request
Figure 1: Request
Path: /api/v1/stock_list/{PK}/excel_import/
Response
This is an asynchronous operation and the status of the operation can be followed when it sends a GET
request at the endpoint where it will check the status with cache_key
.
Bad Response
If there is no valid file, this will raise the exception file_100_1(FileNotFoundException). Status codes and exceptions of Django RESTS are returned because another REST is used.
Check Status with Cache Key
Checking the status of the bulk creation process with the received cache key.
Service(omnitron.catalogs.service.StockListService)
create_stock_list
: A development has been made to ensure that if is_auto_sync True , located in the code.
bulk_upsert
: A development has been made to add multiple ProductStocks
.
Channel Redirections
As mentioned above, when the relevant StockList
and Channel
matching is performed, all ProductStocks linked to the relevant StockList are sent to the Channels.
For instance:
When inspected, the method at `omnitron.channels.integrations.omniweb.integration. Integration.qs__product_stock will show a filter such as _stock_list=catalog channel=self.channel
id
. All ProductStocks
in the select query will be sent by accessing the channel through the catalog linked to the StockList and matching it with the relevant channel.
Data Source
With a similar principle to Channels; Products and Stocks can be used for DataSource
. DataSource
is the structure that enables selling between Omnitron and creates an environment like a marketplace. It is done by direct match over the DataSource model.
Last updated
Was this helpful?