odoo_stock_mo_delete_draft
Delete draft or cancelled manufacturing orders with cascade, bypassing Odoo's deletion constraint. Refuses if stock moves have positive quantity or order is done. Use dry-run first.
Instructions
Safely DELETE a draft or cancelled mrp.production with cascade (raw stock.moves, finished stock.moves, procurement.group if orphaned). Bypasses Odoo's ORM 'cannot be deleted' constraint by forcing state='cancel' via raw SQL, then using DELETE statements inside an ir.actions.server. Refuses if MO has any SVL, stock.move with quantity > 0, or an already-done state. ALWAYS use dry_run=true first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connection | No | default | |
| mo_id | Yes | mrp.production ID to delete | |
| dry_run | No | If true, only preview (no writes). |