Overview
The Stock Request model (stock.request) inherits from stock.request.abstract and provides functionality to request products at a specific location, track their fulfillment through stock moves, and manage the complete lifecycle from draft to completion.
Stock Requests are defined in
stock_request/models/stock_request.py:9Key Features
Lifecycle Management
Track requests through draft, open, done, and cancelled states
Allocation Tracking
Monitor stock moves and allocations linked to the request
Quantity Tracking
Track quantities in progress, done, and cancelled
Procurement Integration
Automatically trigger procurement rules and transfer generation
States
Stock Requests follow a defined lifecycle with four possible states:Draft
Initial state when a stock request is created. Requests can be modified or deleted in this state.
In Progress (Open)
The request has been confirmed and procurement rules have been triggered. Stock moves are being processed.
Done
The request has been fully fulfilled. All requested quantities have been allocated and received.
Essential Fields
Identification and Tracking
| Field | Type | Description |
|---|---|---|
name | Char | Unique identifier for the stock request |
state | Selection | Current status of the request |
requested_by | Many2one (res.users) | User who created the request |
Product and Location
| Field | Type | Description |
|---|---|---|
product_id | Many2one (product.product) | Product being requested |
product_uom_id | Many2one (uom.uom) | Unit of measure for the request |
product_uom_qty | Float | Requested quantity in UoM |
location_id | Many2one (stock.location) | Destination location for the product |
warehouse_id | Many2one (stock.warehouse) | Warehouse associated with the request |
Dates and Policies
| Field | Type | Description |
|---|---|---|
expected_date | Datetime | When you expect to receive the goods |
picking_policy | Selection | ”direct” (receive each product when available) or “one” (receive all at once) |
Relationships
| Field | Type | Description |
|---|---|---|
order_id | Many2one (stock.request.order) | Parent order if this request is part of an order |
allocation_ids | One2many (stock.request.allocation) | Allocations linking to stock moves |
move_ids | One2many (stock.move) | Stock moves generated for this request |
picking_ids | One2many (stock.picking) | Transfer operations associated with this request |
procurement_group_id | Many2one (procurement.group) | Procurement group for generated moves |
route_id | Many2one (stock.route) | Specific route to use for procurement |
Quantity Fields
Stock Requests track three computed quantity fields:stock_request.py:162).
Key Methods
Confirmation
stock_request.py:268).
State Transitions
- Draft
- Cancel
- Done
Procurement
stock_request.py:381) triggers the procurement engine to generate stock moves, purchase orders, or manufacturing orders based on the configured routes.
Use Cases
Inventory Replenishment
Request products to replenish stock at a specific warehouse location
Internal Transfers
Request products to be moved between locations within the company
Purchase Requests
Trigger purchase orders automatically through procurement rules
Manufacturing Requests
Initiate manufacturing orders for products that need to be produced
Constraints and Validations
Example: Creating a Stock Request
Relationship to Products and Locations
Stock Requests establish a clear link between products and locations:- Product: Must be a storable product or consumable (
typein['product', 'consu']) - Location: Typically an internal or transit location where the product is needed
- Warehouse: Provides context for route evaluation and procurement rules
- Route: Determines how the product will be sourced (buy, manufacture, or move)
The framework automatically evaluates available routes based on the product, warehouse, and location configuration (
stock_request_abstract.py:116).