Overview
The Stock Request framework extends the standard Odoostock.picking model to provide visibility into which stock requests are associated with a picking. This enables users to track the relationship between pickings and the stock requests they fulfill.
Model Information
stock.picking
stock.picking
Fields
Stock Request Module
Computed field that returns all stock requests linked to this picking through its moves.
Number of stock requests associated with this picking. Used for displaying smart buttons in the UI.
Stock Return Request Module
Links this picking to a stock return request when the picking is created as part of a return process.
Methods
Stock Request Module
Computes both the stock_request_ids and stock_request_count fields by aggregating stock requests from all moves in the picking.Depends on:
move_idsAction method to view stock requests associated with this picking. Opens either a list view (if multiple requests) or a form view (if single request).Returns: Dictionary representing an ir.actions.act_window action
This method is typically called from a smart button in the picking form view to navigate to related stock requests.
Stock Return Request Module
Extends the backorder creation to ensure that backorders inherit the stock_return_request_id from their parent picking.Returns: Recordset of created backorders
This ensures continuity of the return request link when a picking is partially processed and a backorder is created.
Usage Examples
Accessing Stock Requests from a Picking
Opening Stock Requests View
Working with Return Request Pickings
Creating Backorders with Return Requests
Integration Points
Smart Buttons
Thestock_request_count field is used to display a smart button in the picking form view. When clicked, it calls action_view_stock_request() to show the related stock requests.
Backorder Handling
When a picking linked to a return request is partially processed:- A backorder is created using
_create_backorder() - The extension automatically links the backorder to the same return request
- This maintains traceability throughout the return process
Source Code References
- Stock Request extensions:
stock_request/models/stock_picking.py - Stock Return Request extensions:
stock_return_request/models/stock_picking.py
