Skip to main content
The Stock Request framework is designed to integrate seamlessly with other Odoo modules. This guide covers available integrations and how to configure them.

Available Integration Modules

The Stock Request ecosystem includes several integration modules:

Stock Request Purchase

Automatically generate purchase orders from stock requests

Stock Request MRP

Create manufacturing orders to fulfill stock requests

Stock Request Kanban

Implement Kanban-based inventory replenishment

Stock Request Submit

Add submission/approval workflow for requests

Stock Request Analytic

Track stock requests by analytic account

Stock Request Direction

Configure inbound/outbound request directions

Stock Request BOM

Request components from Bills of Materials

Stock Request Tier Validation

Multi-level approval workflows

Purchase Integration

The Stock Request Purchase module enables automatic purchase order generation from stock requests.

Installation and Configuration

1

Install the Module

Navigate to Apps, search for “Stock Request Purchase”, and click Install.Or enable it from Inventory > Configuration > Settings by checking Enable Stock Requests for Purchases.
2

Configure Product Suppliers

For each product that should be purchased:
  1. Go to Inventory > Products > Products
  2. Open the product and navigate to the Purchase tab
  3. Add vendors with pricing and lead times
3

Enable Buy Route

In the product form, go to the Inventory tab and check the Buy route.
4

Create Stock Request with Buy Route

When creating a stock request, select a Buy route. Confirming the request will automatically create a purchase order.

Purchase Module Features

Automatic PO Creation

When a stock request with a buy route is confirmed, the system:
# Procurement triggers purchase rule
# Purchase rule creates PO line
# PO line is linked back to stock request

class StockRequest(models.Model):
    _inherit = 'stock.request'

    purchase_line_ids = fields.Many2many(
        'purchase.order.line',
        string='Purchase Order Lines',
        readonly=True,
    )
Multiple stock requests can be consolidated into a single purchase order if they request the same product from the same vendor around the same time.

Smart Button Integration

Stock requests display a Purchase Orders smart button showing:
  • Count of related purchase orders
  • Direct navigation to PO list/form
<button name="action_view_purchase"
        icon="fa-shopping-cart"
        invisible="purchase_count == 0">
    <field name="purchase_count" widget="statinfo" 
           string="Purchase Orders" />
</button>

Cancellation Handling

Cancelling a stock request propagates to related purchase orders:
def action_cancel(self):
    res = super().action_cancel()
    if not self.env.context.get('skip_cancel_po_from_stock_request'):
        self.sudo().purchase_ids.filtered(
            lambda x: x.state not in ('purchase', 'done', 'cancel')
            and x.stock_request_ids == self
        ).button_cancel()
    return res
Only draft and sent (RFQ) purchase orders are cancelled. Confirmed purchase orders remain active and must be cancelled manually.

Purchase Workflow Example

1

Create Stock Request

User creates a stock request for 100 units of a purchased product with expected date of March 15.
2

Select Buy Route

User selects the “Buy” route in the stock request form.
3

Confirm Request

User clicks Confirm. The procurement engine is triggered.
4

PO Generation

System creates a purchase order:
  • Vendor: From product supplier configuration
  • Quantity: 100 units
  • Expected delivery: Based on vendor lead time
  • Origin: Stock request reference
5

PO Processing

Purchasing team processes the PO:
  1. Reviews and confirms the PO
  2. Receives goods
  3. Validates the receipt
6

Request Completion

Once goods are received, the stock request automatically transitions to Done state.

Manufacturing Integration

The Stock Request MRP module enables manufacturing order generation from stock requests.

Installation and Configuration

1

Install the Module

Navigate to Apps, search for “Stock Request MRP”, and click Install.Or enable from Inventory > Configuration > Settings by checking Enable Stock Requests for Manufacturing.
2

Configure Bills of Materials

For each manufactured product:
  1. Go to Manufacturing > Products > Bills of Materials
  2. Create a BoM with all required components
  3. Set BoM type and manufacturing workflow
3

Enable Manufacture Route

In the product form, go to Inventory tab and check the Manufacture route.
4

Create Stock Request with MRP Route

When creating a stock request, select a Manufacture route. Confirming triggers manufacturing order creation.

Manufacturing Module Features

Automatic MO Creation

class StockRequest(models.Model):
    _inherit = 'stock.request'

    production_ids = fields.Many2many(
        'mrp.production',
        string='Manufacturing Orders',
        readonly=True,
    )
    production_count = fields.Integer(
        compute='_compute_production_ids',
    )
The manufacturing rule creates production orders with:
  • Product and quantity from the stock request
  • BoM components automatically added
  • Scheduled date based on manufacturing lead time
  • Origin reference to the stock request

Smart Button Integration

Stock requests display a Manufacturing Orders smart button:
<button name="action_view_mrp_production"
        icon="fa-gears"
        invisible="production_count == 0">
    <field name="production_count" widget="statinfo" 
           string="Manufacturing Orders" />
</button>

Manufacturing Workflow Example

1

Create Stock Request

User requests 50 units of a manufactured product (e.g., assembled bicycles).
2

Select Manufacture Route

User selects the “Manufacture” route.
3

Confirm Request

User confirms. System creates a manufacturing order for 50 bicycles.
4

Component Reservation

System reserves components (frame, wheels, brakes, etc.) based on BoM.
5

Production Processing

Manufacturing team:
  1. Confirms the MO
  2. Produces the bicycles
  3. Validates production
6

Request Fulfillment

Finished products are moved to the request destination, completing the stock request.

Submit Workflow Integration

The Stock Request Submit module adds an approval workflow with a Submitted state.

Installation and Configuration

1

Enable the Module

Go to Inventory > Configuration > Settings and check Enable Submitted State.
2

Install and Configure

The system installs the module. No additional configuration needed.

Submit State Workflow

The module adds a new state between Draft and In Progress:
class StockRequest(models.Model):
    _inherit = 'stock.request'

    state = fields.Selection(
        selection_add=[('submitted', 'Submitted'), ('open',)]
    )

    def action_submit(self):
        self._action_submit()

    def _action_submit(self):
        self.state = 'submitted'
1

Draft

User creates and edits the stock request.
2

Submit

User clicks Submit button. Request enters Submitted state.
In submitted state, the request is awaiting manager approval. No procurement is triggered yet.
3

Review

Manager reviews submitted requests and either:
  • Confirms the request (triggers procurement)
  • Returns to draft for modifications
  • Cancels the request
4

Confirmation

Upon confirmation, request proceeds to In Progress and procurement begins.
Combine the Submit module with Tier Validation for multi-level approval workflows.

Kanban Integration

The Stock Request Kanban module implements Kanban-based inventory replenishment.

Kanban Cards

Kanban cards are physical or virtual cards that trigger replenishment:

Automatic Requests

Scanning a Kanban card automatically creates a stock request

Fixed Quantities

Each card represents a predefined quantity

Location-Specific

Cards are configured for specific locations and products

Inventory Sync

Can trigger inventory adjustments alongside requests

Configuration Example

# Create Kanban card for a product
kanban_card = env['stock.request.kanban'].create({
    'name': 'KANBAN-001',
    'product_id': product.id,
    'product_uom_qty': 100.0,  # Fixed quantity per card
    'location_id': production_line.id,
    'warehouse_id': warehouse.id,
})

# When card is scanned/triggered
kanban_card.action_request()  # Creates stock request automatically
Kanban cards can be printed with barcodes for easy scanning in the warehouse.

Tier Validation Integration

The Stock Request Tier Validation module adds multi-level approval workflows.

Configuration

1

Install Module

Search for “Stock Request Tier Validation” in Apps and install.
2

Configure Tier Definitions

Navigate to Settings > Technical > Tier Validations > Tier Definition.Create definitions like:
  • Tier 1: Supervisor approval for requests > $1,000
  • Tier 2: Manager approval for requests > $5,000
3

Set Approval Criteria

Configure domain filters and user groups for each tier.

Approval Workflow

# Stock request with tier validation
class StockRequest(models.Model):
    _name = 'stock.request'
    _inherit = ['stock.request', 'tier.validation']

    # Validation methods
    def validate_tier(self):
        # Approve current tier
        pass

    def reject_tier(self):
        # Reject and return to requester
        pass
1

Request Submission

User submits stock request. System evaluates tier definitions.
2

Tier 1 Review

First approver receives notification and reviews the request.
3

Tier 2 Review

If applicable, second approver reviews after Tier 1 approval.
4

Final Confirmation

After all tiers approve, request can be confirmed and procurement triggered.

Analytic Integration

The Stock Request Analytic module adds analytic accounting to stock requests.

Features

  • Assign analytic accounts to stock requests
  • Assign analytic tags for multi-dimensional analysis
  • Track stock request costs by project or department
  • Generate analytic reports on stock requests

Configuration

1

Enable Analytic Accounting

Go to Inventory > Configuration > Settings and enable Enable Analytic Accounting in Stock Requests.
2

Add Analytic Accounts

In the stock request form, new fields appear:
  • Analytic Account: Project or cost center
  • Analytic Tags: Additional dimensions
3

Track by Analytics

Use analytic reports to track stock request costs by project, department, or other dimensions.

Direction Integration

The Stock Request Direction module adds direction configuration for inbound and outbound requests.

Use Cases

Inbound Requests

Request products to be brought into a location

Outbound Requests

Request products to be sent out of a location

Configuration

class StockRequest(models.Model):
    _inherit = 'stock.request'

    direction = fields.Selection([
        ('inbound', 'Inbound'),
        ('outbound', 'Outbound'),
    ], string='Direction')
Direction affects how routes and rules are evaluated, allowing different procurement logic for inbound vs. outbound requests.

BOM Integration

The Stock Request BOM module allows requesting components from Bills of Materials.

Features

  • Select a BoM and automatically create stock requests for all components
  • Useful for requesting production materials
  • Quantities are calculated based on BoM ratios

Usage Example

1

Create Stock Request Order

Create a new stock request order.
2

Select BOM

Use the BOM selection feature to choose a Bill of Materials.
3

Generate Component Requests

System automatically creates line items for each BoM component with calculated quantities.
4

Adjust and Confirm

Review quantities, adjust if needed, and confirm the order.

Return Request Integration

The Stock Return Request module adds functionality for handling returns.

Features

  • Create return requests for products
  • Link returns to original deliveries
  • Track return reasons and lot numbers
  • Generate return reports

Workflow

1

Identify Return

Identify products that need to be returned (damaged, wrong item, etc.).
2

Create Return Request

Create a return request specifying product, quantity, and reason.
3

Process Return

System creates appropriate stock moves to handle the return.
4

Quality Check

Optionally route returns through quality control.

Custom Integration Development

Extending Stock Requests

To create your own integration module:
# __manifest__.py
{
    'name': 'Stock Request Custom Integration',
    'depends': ['stock_request'],
}

# models/stock_request.py
from odoo import fields, models

class StockRequest(models.Model):
    _inherit = 'stock.request'

    # Add custom fields
    custom_field = fields.Char('Custom Field')

    # Extend methods
    def action_confirm(self):
        # Custom logic before confirmation
        self._custom_pre_confirm()
        # Call parent method
        result = super().action_confirm()
        # Custom logic after confirmation
        self._custom_post_confirm()
        return result

    def _custom_pre_confirm(self):
        # Your custom integration logic
        pass

    def _custom_post_confirm(self):
        # Your custom integration logic  
        pass

Hooking into Procurement

To customize procurement behavior:
class StockRequest(models.Model):
    _inherit = 'stock.request'

    def _prepare_procurement_values(self, group_id=False):
        values = super()._prepare_procurement_values(group_id)
        # Add custom values
        values.update({
            'custom_key': self.custom_field,
            'another_key': self.compute_custom_value(),
        })
        return values

Adding Smart Buttons

<!-- views/stock_request_views.xml -->
<record id="view_stock_request_form_inherit" model="ir.ui.view">
    <field name="name">stock.request.form.custom</field>
    <field name="model">stock.request</field>
    <field name="inherit_id" ref="stock_request.view_stock_request_form"/>
    <field name="arch" type="xml">
        <xpath expr="//div[@name='button_box']" position="inside">
            <button type="object"
                    name="action_view_custom_records"
                    class="oe_stat_button"
                    icon="fa-custom-icon"
                    invisible="custom_count == 0">
                <field name="custom_count" widget="statinfo" 
                       string="Custom Records"/>
            </button>
        </xpath>
    </field>
</record>

Integration Best Practices

Start with standard integrations: Use the official integration modules before building custom ones. They follow best practices and are well-maintained.
  • Keep integration modules independent when possible
  • Use proper inheritance patterns (_inherit, not _inherits)
  • Extend methods with super() calls to maintain compatibility
  • Add security rules for custom fields and models
  • Document integration behavior for users
  • Test integrations across module combinations
  • Follow OCA module structure guidelines
  • Use appropriate depends in __manifest__.py
  • Version your integration modules alongside stock_request versions
  • Contribute useful integrations back to the OCA community

Troubleshooting Integrations

Possible Causes:
  • Stock Request Purchase module not installed
  • Product has no vendors configured
  • Wrong route selected
Solutions:
  • Verify module installation in Apps
  • Add vendor in product’s Purchase tab
  • Select a Buy route on the stock request
Possible Causes:
  • Bill of Materials not configured
  • BoM components marked as phantom
Solutions:
  • Create or update BoM in Manufacturing > Products > Bills of Materials
  • Verify BoM type and component availability
Possible Causes:
  • Tier definitions not configured
  • User doesn’t have validation permissions
  • Domain filter doesn’t match the request
Solutions:
  • Configure tier definitions in Settings > Technical > Tier Validations
  • Add user to appropriate validation groups
  • Review domain filters in tier definition
Possible Causes:
  • Stock move analytic integration not installed
  • Analytic account not set on stock request
Solutions:
  • Verify Stock Request Analytic module is installed
  • Ensure analytic account is set before confirming request
  • Check that analytic accounting is enabled in company settings

Build docs developers (and LLMs) love