odoo_stock_product_flip_to_storable
Flip a product from consumable to storable despite existing stock moves. Used when a GRN was recorded for a product mistakenly set as consumable. Always preview with dry_run.
Instructions
Flip a product from consumable (is_storable=false) to storable (is_storable=true) when the product ALREADY has stock.move records. Bypasses Odoo's ORM constraint 'You can not change the inventory tracking of a product that was already used' via raw SQL in an ir.actions.server. Then inserts a stock.quant DIRECTLY (not through an inventory adjustment wizard) so no duplicate SVL is created — existing SVLs stay intact. Use when a GRN/bill was recorded for a product that was mistakenly set as consu. ALWAYS use dry_run=true first to preview impact. Returns full pre/post snapshot.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connection | No | default | |
| product_id | Yes | product.product ID to flip | |
| location_id | Yes | stock.location ID where the quant will be created (usually GRN destination) | |
| quantity | Yes | Quantity to set as on-hand (must match existing SVL remaining_qty for consistency) | |
| company_id | Yes | Company ID — scope of the operation | |
| in_date | Yes | ISO datetime for stock.quant.in_date (e.g. '2026-04-20 14:40:34'). Should match GRN date. | |
| dry_run | No | If true, only preview actions (no writes). Set false to execute. |