Accounting Scenario Framework
by Terrabit https://www.terrabit.ro , Dorin Hongu https://www.terrabit.ro| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Inventory (stock)
• Invoicing (account) • Discuss (mail) • Purchase (purchase) |
| Lines of code | 2399 |
| Technical Name |
deltatech_account_scenario |
| License | LGPL-3 |
| Website | https://www.terrabit.ro |
# deltatech_account_scenario
Stock Test — Management Accounting Test Framework
An advanced Odoo 19 module for testing stock and management accounting functionality via JSON-driven scenarios. Inspired by and compatible with the test patterns used in l10n_ro_stock_account.
---
## Overview
This module allows you to define test scenarios as JSON documents stored in the database. Each scenario describes a sequence of business operations (purchases, sales, inventory adjustments, internal transfers) along with inline assertions that verify stock quantities and accounting balances after each step.
Scenarios can be used for:
- Automated regression tests — validate that accounting entries are correct after module upgrades or configuration changes.
- Demo data generation — populate a database with realistic stock and accounting data for demonstrations or onboarding.
- Manual QA — run scenarios from the UI with a single button click and inspect the execution log.
---
## Features
### Advanced Step Types (inspired by l10n_ro_stock_account)
### Setup Step Types
### Legacy Step Types (backward compatible)
### Inline Checks
After any step, add a "checks" key to verify state immediately:
"step": "purchase", "product_code": "PROD-001", "qty": 10, "price": 100, "checks": {
- "stock": {
- "PROD-001": [{"qty": 10, "value": 1000}]
}, "account": {
"371000": 1000}
}
}
- `checks.stock` — verifies stock.quant quantity and value per product/location.
- `checks.account` — verifies cumulative balance of posted account.move.line per account code (same logic as l10n_ro_stock_account).
---
## JSON Scenario Format
"name": "Scenario Name", "lines": [
- {
"step": "<step_type>", ... step-specific fields ..., "checks": {
"stock": { "<product_code>": [{"location": "WH/Stock", "qty": 10, "value": 1000}] }, "account": { "<account_code>": <expected_balance> }}
}
], "expected_account_moves": [
- {
"journal": "Journal Name", "line_ids": [
{"account": "4111", "debit": 0, "credit": 1650}, {"account": "707", "debit": 1500, "credit": 0}]
}
]
}
### Step field reference
#### purchase
"step": "purchase", "partner_name": "Vendor Name", "product_code": "PROD-001", "qty": 10.0, "price": 100.0, "inv_qty": 10.0, "inv_price": 100.0
}
#### sale
"step": "sale", "partner_name": "Customer Name", "product_code": "PROD-001", "qty": 5.0, "price": 150.0, "inv_qty": 5.0, "inv_price": 150.0
}
#### inventory
"step": "inventory", "product_code": "PROD-001", "qty": 100.0, "location": "WH/Stock"
}
#### transfer_direct
"step": "transfer_direct", "product_code": "PROD-001", "qty": 30.0, "location": "WH/Stock", "location1": "WH/Output"
}
#### transfer_transit
"step": "transfer_transit", "product_code": "PROD-001", "qty": 20.0, "location": "WH/Stock"
}
#### create_product_category
"step": "create_product_category", "name": "Marfuri", "property_cost_method": "average", "property_valuation": "real_time"
}
property_cost_method: standard, average, fifo property_valuation: manual_periodic, real_time
#### create_product
"step": "create_product", "code": "PROD-001", "name": "Product Name", "categ_key": "categ_Marfuri", "standard_price": 100.0, "list_price": 150.0, "type": "consu"
}
---
## Models
### stock.test.scenario fields
### stock.test.run fields
---
## Dependencies
- account — accounting entries validation
- stock — stock operations
- stock_account — stock valuation and accounting
- purchase — purchase orders (for purchase step)
- sale_management — sale orders (for sale step)
---
## Installation
`bash ./odoo/odoo-bin -c odoo18.conf -d mydb -i deltatech_account_scenario --stop-after-init `
---
## Running Tests
```bash ./odoo/odoo-bin -c odoo18.conf -d o19_test
-u deltatech_account_scenario --test-tags=deltatech_account_scenario --stop-after-init
---
## Comparison with l10n_ro_stock_account
---
## License
LGPL-3.0 or later — see [LICENSE](LICENSE) file.
## Author
Deltatech — <https://www.terrabit.ro>
Please log in to comment on this module