odoo_stock_close_unaccounted_value
Creates inventory valuation journal entries for unaccounted stock movements, auto-detecting GRNI accounts per Odoo version and allowing overrides. Use dry_run=true to preview.
Instructions
Create an Inventory Valuation journal entry (Dr stock valuation / Cr GRNI/stock-input) for a stocked movement that was valued but not accounted (account_move_id=false), then bind the new account.move back to the record. Version-aware: works on stock.valuation.layer (Odoo 14-18) OR stock.move (Odoo 19+). GRNI account auto-detection order: (a) v14-18 → category.property_stock_account_input_categ_id; (b) v19 with l10n_bg_stock_account → category.l10n_bg_stock_input_account_id; (c) v19 vanilla → category.account_stock_variation_id (fallback). User can override via grni_account_id parameter. Refuses if record is already accounted or category is not real_time. ALWAYS use dry_run=true first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connection | No | default | |
| record_id | Yes | ID of stock.valuation.layer (v14-18) or stock.move (v19+) | |
| source_model | No | Source model override; 'auto' detects from Odoo version. | auto |
| grni_account_id | No | Override GRNI/stock-input account. If omitted, auto-detected from category. | |
| date | No | Journal entry date (ISO). Defaults to record's date/create_date. | |
| dry_run | No | If true, only preview. Set false to execute. |