Automated Stock Valuation Engine
by Abdelrahman Ashraf https://www.linkedin.com/in/abdelrahman-ashraf-ahmed-ahmed/
Odoo
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Inventory (stock)
• Invoicing (account) • Manufacturing (mrp) • Purchase (purchase) • Sales (sale_management) • Discuss (mail) |
| Lines of code | 853 |
| Technical Name |
custom_stock_valuation |
| License | LGPL-3 |
| Website | https://www.linkedin.com/in/abdelrahman-ashraf-ahmed-ahmed/ |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Inventory (stock)
• Invoicing (account) • Manufacturing (mrp) • Purchase (purchase) • Sales (sale_management) • Discuss (mail) |
| Lines of code | 853 |
| Technical Name |
custom_stock_valuation |
| License | LGPL-3 |
| Website | https://www.linkedin.com/in/abdelrahman-ashraf-ahmed-ahmed/ |
Automated Stock Valuation Engine
Odoo 19 Community Edition — Full perpetual inventory accounting without Enterprise license.
Automatically generates all stock valuation journal entries for purchases, sales, manufacturing, inventory adjustments, and landed costs. Replaces the valuation entries normally only available in the Enterprise edition.
Video Demo
Features
- Purchase Receipt — DR Stock Valuation / CR Stock Input (GR/IR)
- Vendor Bill — GR/IR clearing bridge entry
- Sale Delivery — DR Stock Output / CR Stock Valuation
- Customer Invoice — COGS recognition (DR COGS / CR Stock Output)
- Manufacturing — Raw material consumption (WIP) + finished goods receipt
- Inventory Adjustments — Loss/gain entries with correct directional posting
- Landed Costs — Capitalisation into stock valuation asset
- Purchase/Sale Returns — Automatic reversal entries
- Multi-currency — PO currency conversion to company currency
Accounting Flows
| Operation | DR | CR | Trigger |
|---|---|---|---|
| Purchase Receipt | Stock Valuation | Stock Input / GR-IR | Receipt validation |
| Vendor Bill | Stock Input / GR-IR | Purchase Expense | Bill posting |
| Sale Delivery | Stock Output | Stock Valuation | Delivery validation |
| Customer Invoice | COGS | Stock Output | Invoice posting |
| MFG Raw Material | Production / WIP | Stock Valuation | Consumption |
| MFG Finished Goods | Stock Valuation | Production / WIP | Finished goods receipt |
| Inventory Loss | Inventory Loss | Stock Valuation | Adjustment/Scrap |
| Inventory Gain | Stock Valuation | Inventory Loss | Adjustment |
| Landed Costs | Stock Valuation | LC Clearing | LC validation |
Configuration
⚠ Important: Set your product category's
Costing Method to Periodic (not
Perpetual/Automated) to prevent the standard Odoo engine from interfering
with this module's journal entries. The module handles all valuation
posting itself.
Step-by-step
- Install the module (dependencies: stock, account, purchase, sale_management, mrp, stock_landed_costs)
-
Post-install hook automatically creates 6 accounts with
default codes (adjustable in
hooks.py):
| Account | Default Code | Type |
|---|---|---|
| Stock Valuation | 151000 | Asset (Current) |
| Stock Input (GRNI) | 251000 | Liability (Current) |
| Stock Output (Interim) | 152000 | Asset (Current) |
| Cost of Goods Sold | 600000 | Expense |
| Production / WIP | 153000 | Asset (Current) |
| Inventory Loss | 620000 | Expense |
- Verify accounts in Accounting → Settings → Automated Stock Valuation
- Set per-category overrides (optional) in Inventory → Configuration → Product Categories
- Set costing method to Periodic on each product category
- Done! Entries generate automatically on stock moves, vendor bills, customer invoices, and landed cost validation
Idempotency & Duplicate Protection
Every generated journal entry uses a structured ref to
prevent duplicates:
| Operation | Ref Pattern |
|---|---|
| Purchase Receipt | GR/<picking_name> |
| Sale Delivery | DO/<picking_name> |
| MFG Consumption | MFG-IN/<picking_name> |
| MFG Finished Goods | MFG-OUT/<picking_name> |
| Inventory Adjustment | INV-ADJ/<picking_name> |
| GR/IR Clearing | GRIR/CLR/<bill_name>/L<line_id> |
| COGS | COGS/<invoice_name>/L<line_id> |
| Landed Cost | LC/<lc_name>/L<line_id> |
Dependencies
stock— Inventoryaccount— Accountingpurchase— Purchase managementsale_management— Sales managementmrp— Manufacturingstock_landed_costs— Landed costs
Compatibility
Odoo 19 Community Edition only. Not needed for Enterprise (built-in).
-
account.account.company_idsis Many2many (notcompany_id) -
stock.move.quantityreplacesquantity_done -
product.template.type == 'consu'means storable (was'product'pre-Odoo 16) post_init_hookreceivesenvdirectly
License: LGPL-3
Author: Abdelrahman Ashraf
Please log in to comment on this module