Skip to main content
Glama

odoo_stock_initial_delete

Delete wrong opening stock balances: cascade-removes inventory stock moves, lines, and valuation layers, zeros stock quants. Includes pre-flight validation and automatic backup before deletion.

Instructions

Delete wrong opening stock balances — cascade-removes stock.move (is_inventory=TRUE) records, their stock.move.line, and (v14-v18) stock.valuation.layer; then zeros out stock.quant on affected (product, location, lot). Bypasses Odoo's ORM guard 'You can not delete product moves if the picking is done' via raw SQL in an ir.actions.server + env.cr.commit(). Version-aware: v14-v18 DELETEs SVL→SML→SM; v19 DELETEs SML→SM (SVL doesn't exist). PRE-FLIGHT: refuses if any affected SVL/stock.move has account_move_id set (orphan journal entries would remain). Caller must reverse those first. ALWAYS writes a full JSON backup to /backups// BEFORE any delete. ALWAYS use dry_run=true first to see the impact scope.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionNodefault
company_idYesCompany scope — only records with this company_id are touched
tzYesIANA timezone of the caller. Used to interpret date_from/date_to (start_of_day / end_of_day in this tz → UTC).
date_fromNoOptional YYYY-MM-DD, start-of-day in tz. Filters stock.move.date >= UTC(date_from 00:00 tz).
date_toNoOptional YYYY-MM-DD, end-of-day in tz. Filters stock.move.date <= UTC(date_to 23:59:59 tz).
location_idsNoOptional list of stock.location IDs to filter by (either src or dst). If omitted, all locations in company.
dry_runNoIf true, only preview + backup preview. Set false to execute (backup is still written).
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden and excels by detailing cascade behavior, version differences, pre-flight checks, backup writing, and raw SQL usage. It fully discloses the tool's behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but well-organized with key points. Slightly verbose but every sentence adds value, earning a high score.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (cascade deletes, version awareness, backup, pre-flight), the description is complete and covers all necessary context for safe and correct usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 86%, so the input schema already describes parameters well. The description does not add significant parameter-specific meaning beyond reinforcing dry_run usage, meeting the baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it deletes wrong opening stock balances with specific details on cascade removal, version awareness, and bypassing ORM guards. It is distinguished from siblings like odoo_stock_initial_import and odoo_stock_mo_delete_draft by its specific purpose and actions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage context: always use dry_run=true first, pre-flight checks, and required reversal of account_move_id. It does not explicitly name alternatives but the context implies when to use this tool (wrong opening stock balances).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rosenvladimirov/odoo-claude-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server