| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Discuss (mail)
• Invoicing (account) • Purchase (purchase) |
| Community Apps Dependencies | Show |
| Lines of code | 5945 |
| Technical Name |
grev_od_commodity_contract |
| License | OPL-1 |
| Website | https://www.grevlin.com |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Discuss (mail)
• Invoicing (account) • Purchase (purchase) |
| Community Apps Dependencies | Show |
| Lines of code | 5945 |
| Technical Name |
grev_od_commodity_contract |
| License | OPL-1 |
| Website | https://www.grevlin.com |
🌾 Commodity ContractsFull Commodity Trading Contract Suite — Spot, Forward, Futures, Options, Swaps, Pricing Formulas & Mark-to-Market
|
|
|
|
|
|
📞 Need Help?
|
|
Grevlin Procurement Suite Enterprise-Grade Commodity Trading Solutions for Odoo © 2026 Grevlin Global Corp. All Rights Reserved. Compatible with Odoo 19.0 | Licensed under OPL-1 |
Commodity Contracts
The Commodity Contracts module provides professional commodity trading contract management for Odoo 19.0. It supports spot, forward, futures, option, term, and swap contracts with a powerful pricing formula engine, Black-Scholes option Greeks, mark-to-market valuations, delivery scheduling, rollover and washout workflows, and automatic purchase/sale order generation.
Overview
This module manages the full commodity contract lifecycle from draft through settlement or expiry. Contracts link commodity suppliers to pricing terms, quality rules, and penalty clauses, and serve as the contractual foundation for the entire commodity procurement chain.
Key Capabilities
- 8 Contract Types -- spot, forward, futures, option, term, swap, fixed-price, and market-linked contracts with buy/sell direction.
- Pricing Formula Engine -- six formula types (fixed, basis, differential, average, min/max, custom) with floor/ceiling collars and price fixation workflows.
- Mark-to-Market & Margins -- position tracking, unrealized P&L, initial/variation margins, and margin call monitoring.
- Black-Scholes Greeks -- option delta, gamma, theta, and vega computation for commodity options.
- Delivery Scheduling -- delivery start/end dates, tolerance tracking, delivery month assignment, and fulfillment percentage.
- Rollover & Washout -- roll expiring contracts to new periods, offset open positions, and maintain parent-child contract chains.
- Quality Rules -- override base quality parameter thresholds at the contract level for supplier-specific agreements.
- Penalty Clauses -- fixed or percentage penalties for late delivery, under-delivery, and quality breaches.
- Automatic PO Generation -- create purchase or sale orders from active contracts with remaining quantity tracking.
- Swap Contracts -- multi-leg swap structures with independent pricing per leg.
Note
This module depends on grev_od_commodity_base for commodity types, grades, and quality parameters, and on grev_od_commodity_supplier for supplier partner profiles. Delivery, quality testing, and settlement logic belong to their respective modules.
Configuration
Dependencies
Install the following modules before installing Commodity Contracts:
- grev_od_commodity_base -- commodity types, grades, parameters
- grev_od_commodity_supplier -- commodity supplier management
The module also requires purchase, account, and mail from standard Odoo.
Scheduled Actions
Three crons ship with the module. All are active by default.
| Cron | Frequency | Purpose |
|---|---|---|
| Contract Expiry Check | Daily | Auto-expires contracts past their delivery end date. |
| Margin Call Monitor | Daily | Checks margin levels and creates alerts when thresholds are breached. |
| Option Expiry Monitor | Daily | Monitors option contract expiry dates and triggers settlement workflows. |
Security Groups
The module uses centralized security groups from grev_od_commodity_base:
Commodity User (group_commodity_user)
- Read-only access to contracts, pricing formulas, positions, valuations, quality rules, and penalties.
- Cannot create or modify records.
Commodity Officer (group_commodity_officer)
- Create and edit contracts, pricing formulas, delivery schedules, quality rules, and penalties.
- Generate purchase/sale orders from active contracts.
- Cannot delete records.
- Inherits Commodity User permissions.
Commodity Manager (group_commodity_manager)
- Full CRUD including delete on all contract models.
- Can activate, suspend, and settle contracts directly.
- Inherits Commodity Officer permissions.
Note
Multi-company record rules apply to all models using the pattern ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)].
Usage
Creating a Contract
- Navigate to :menuselection:`Commodity --> Contracts --> Contracts`.
- Click :guilabel:`Create`.
- Fill in the required fields:
- :guilabel:`Supplier` -- the commodity supplier partner.
- :guilabel:`Commodity` -- the commodity type being traded.
- :guilabel:`Contract Type` -- spot, forward, futures, etc.
- :guilabel:`Direction` -- buy or sell.
- :guilabel:`Contract Quantity` and :guilabel:`Base Price`.
- :guilabel:`Delivery Start` / :guilabel:`Delivery End`.
- Optionally assign a :guilabel:`Pricing Formula` for market-linked contracts.
- Add :guilabel:`Quality Rules` and :guilabel:`Penalties` in their respective tabs.
- Click :guilabel:`Confirm` to move to the confirmed state.
Setting Up a Pricing Formula
- Open a contract and click the :guilabel:`Pricing Formula` tab.
- Click :guilabel:`Create` to add a new formula.
- Select the :guilabel:`Formula Type`:
- Fixed -- uses base_price directly.
- Basis -- base price plus/minus a differential.
- Differential -- price relative to a reference commodity.
- Average -- average of market prices over a period.
- Min/Max -- price bounded by floor and ceiling.
- Custom -- Python expression using safe_eval.
- Set floor/ceiling prices if applicable.
- The :guilabel:`Computed Price` updates automatically.
- Use :guilabel:`Fix Price` to lock the formula at a specific moment.
Activating and Generating Orders
- From a confirmed contract, click :guilabel:`Activate`.
- Once active, click :guilabel:`Generate Purchase Order` (buy-side) or :guilabel:`Generate Sale Order` (sell-side).
- The system creates an order for the remaining contract quantity at the current contract price.
- Fulfillment percentage updates automatically as deliveries are received against the linked purchase order lines.
Managing Positions
- Navigate to :menuselection:`Commodity --> Contracts --> Positions`.
- View open positions with current market value, unrealized P&L, and margin status.
- Margin calls are flagged automatically when variation margin exceeds the configured threshold.
Rollover and Washout
Rollover: To roll an expiring contract to a new delivery period, open the contract and click :guilabel:`Rollover`. A new child contract is created with the same terms but updated delivery dates. The parent contract is settled.
Washout: To offset an open position, open the contract and click :guilabel:`Washout`. The system creates an offsetting contract and settles both positions at the washout price.
Technical Details
Data Models
| Model | Type | Description |
|---|---|---|
| grev.commodity.contract | Model | Core commodity contract with lifecycle and pricing. |
| grev.commodity.pricing.formula | Model | Pricing formula definitions with computation engine. |
| grev.commodity.contract.position | Model | Position tracking with unrealized P&L. |
| grev.commodity.contract.margin | Model | Initial and variation margin management. |
| grev.commodity.contract.valuation | Model | Mark-to-market valuation snapshots. |
| grev.commodity.contract.option | Model | Option-specific fields and Greeks computation. |
| grev.commodity.contract.rollover | Model | Rollover transaction records. |
| grev.commodity.contract.washout | Model | Washout/offset transaction records. |
| grev.commodity.contract.swap | Model | Swap contract header. |
| grev.commodity.contract.swap.leg | Model | Individual swap legs with independent pricing. |
| grev.commodity.contract.delivery.schedule | Model | Delivery scheduling lines. |
| grev.commodity.contract.quality.rule | Model | Contract-level quality parameter overrides. |
| grev.commodity.contract.penalty | Model | Penalty clause definitions. |
| purchase.order | Extended | Extended with commodity_contract_id linkage. |
Troubleshooting
Pricing Formula Not Computing
Symptom: computed_price shows 0 on a formula record.
Checks:
- Verify the formula has a base_price set (required for all types except custom).
- For custom formulas, ensure the expression field contains valid Python that returns a numeric value.
- Check that safe_eval can evaluate the expression without errors in the Odoo server log.
Fulfillment Percentage Stuck at Zero
Symptom: fulfillment_pct does not update after deliveries.
Checks:
- Confirm that purchase orders were generated from the contract (linked via commodity_contract_id).
- Verify that PO line qty_received has been updated by stock receipts.
- The field is compute + store=True. Trigger recomputation by saving the contract or running grev.commodity.contract._compute_delivered_quantity() from a shell.
Margin Calls Not Triggering
Symptom: No margin call alerts despite position losses.
Checks:
- Confirm the Margin Call Monitor scheduled action is active.
- Verify that the contract has a margin record with the initial margin amount set.
- Check that the current market price is available for the mark-to-market computation.
See Also
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module