Skip to content

Stock Journal Documentation

Overview

The Stock Journal module (stock.journal) defines different types of stock movements and their default settings. Journals categorize inventory transactions (receipts, issues, transfers) and provide default locations and numbering sequences for pickings.


Model Information

Model Name: stock.journal
Display Name: Stock Journal
Key Fields: name

Features

  • ❌ Audit logging disabled
  • ❌ Multi-company support (fields support multi-company)
  • ❌ Full-text content search disabled
  • ✅ Unique key constraint on name

Journal Types

Type Code Description
Receive From Supplier in Goods receipts from suppliers
Pack For Customer out Goods issues to customers
Goods Transfer internal Internal location transfers
Return To Supplier out_return Supplier returns
Return From Customer in_return Customer returns
Product Waste waste Waste/disposal movements
Product Transforms transform Product transformations
Lot Expiry Journal expiry Expired lot movements
Forecast Journal forecast Planning/forecast movements
Production Plan production_plan Production planning
Other other Miscellaneous

Key Fields Reference

Header Fields

Field Type Required Description
name Char Journal name (unique)
code Char Short code
type Selection Journal type

Configuration Fields

Field Type Description
sequence_id Many2One Auto-numbering sequence for pickings
location_from_id Many2One Default source location
location_to_id Many2One Default destination location
require_sale Boolean Require sales order linkage

Relationship Fields

Field Type Description
comments One2Many Discussion thread

API Methods

1. Create Journal

Method: create(vals, context)

Creates a new stock journal.

Example:

# Create goods receipt journal
journal_id = get_model("stock.journal").create({
    "name": "Goods Receipt - Main",
    "code": "GR-MAIN",
    "type": "in",
    "sequence_id": 10,
    "location_to_id": 5  # Warehouse location
})

# Create goods issue journal
gi_journal_id = get_model("stock.journal").create({
    "name": "Goods Issue - Shipping",
    "code": "GI-SHIP",
    "type": "out",
    "sequence_id": 11,
    "location_from_id": 5,  # Warehouse
    "require_sale": True     # Must link to sales order
})


Common Use Cases

Use Case 1: Setup Standard Journals

# Receiving journal
gr_journal = get_model("stock.journal").create({
    "name": "Goods Receipt",
    "code": "GR",
    "type": "in",
    "sequence_id": seq_gr_id,
    "location_to_id": warehouse_loc_id
})

# Shipping journal
gi_journal = get_model("stock.journal").create({
    "name": "Goods Issue",
    "code": "GI",
    "type": "out",
    "sequence_id": seq_gi_id,
    "location_from_id": warehouse_loc_id
})

# Transfer journal
gt_journal = get_model("stock.journal").create({
    "name": "Goods Transfer",
    "code": "GT",
    "type": "internal",
    "sequence_id": seq_gt_id
})

Use Case 2: Create Picking with Journal

# Journal provides defaults
journal = get_model("stock.journal").browse(journal_id)

picking_vals = {
    "type": journal.type or "internal",
    "journal_id": journal.id,
    "lines": [
        ("create", {
            "product_id": 100,
            "qty": 50,
            "uom_id": 1,
            "location_from_id": journal.location_from_id.id,  # From journal
            "location_to_id": journal.location_to_id.id        # From journal
        })
    ]
}

pick_id = get_model("stock.picking").create(
    picking_vals,
    context={"pick_type": journal.type, "journal_id": journal.id}
)

Model Relationship Description
stock.picking Many2One Pickings use journals
stock.location Many2One Default from/to locations
sequence Many2One Auto-numbering sequence

Best Practices

1. One Journal Per Movement Type

# Good: Separate journals for each purpose
gr_journal = "Goods Receipt - Supplier"
gi_journal = "Goods Issue - Customer"  
gt_journal = "Internal Transfer"

# Avoid: Single journal for multiple types
mixed_journal = "All Movements"  # Makes reporting difficult

2. Set Default Locations

# Always set default locations on journals
journal_vals = {
    "name": "Goods Receipt",
    "type": "in",
    "location_from_id": supplier_loc_id,  # Default supplier location
    "location_to_id": warehouse_loc_id     # Default warehouse
}

Troubleshooting

"Missing sequence"

Cause: Journal has no sequence_id configured
Solution: Create and assign a sequence to the journal

"Picking number not generated"

Cause: Sequence not found or exhausted
Solution: Check sequence configuration and increment settings


This documentation is generated for developer onboarding and reference purposes.