odoo-data-ops
Skill2 starsChanged 3 months agoMITView on GitHub
Expertise required to safely query and modify Odoo business data while maintaining a rigorous audit trail and reversibility context.
In this repository30 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- odoo-attendanceSkill
- odoo-crmSkill
- odoo-dashboardsSkill
- odoo-devSkill
- odoo-documentsSkill
- odoo-field-serviceSkill
- odoo-financeSkill
- odoo-frontdeskSkill
- odoo-get-startedSkill
- odoo-helpdeskSkill
- odoo-hrSkill
- odoo-introspectorSkill
- odoo-inventorySkill
- odoo-knowledgeSkill
- odoo-mrpSkill
- odoo-plmSkill
- odoo-productsSkill
- odoo-projectsSkill
- odoo-purchasingSkill
- odoo-qualitySkill
- odoo-relationsSkill
- odoo-reportsSkill
- odoo-salesSkill
- odoo-securitySkill
- odoo-spreadsheetsSkill
- odoo-uxSkill
- odoo-websiteSkill
- odoo-worksheetsSkill
- odoo-workspaceSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 6 are distinctive, and 14 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Breadth (
search_records): ALWAYS use search_records first to discover data and locate specific IDs. - Very specific: line 14
Safe Defaults: Leave fields blank/empty to fetch our optimized, low-token "Breadth Layout" (ID, Display Name, State, Freshness, and the …
- Very specific: line 22
AND (
&): Default behavior. ['&', (A), (B)] means A and B. - Very specific: line 28
All state-changing operations (create_record, write_record, unlink_record) require a justification parameter.
- Very specific: line 33
Every CRUD tool supports an instance_alias parameter.
- Distinctive: line 34
Default: If omitted, the tool uses the current session's default instance.
- Very specific: line 38
Fields Overrides: If you need specific extra fields in search_records, pass them explicitly in the fields array.
- Very specific: line 39
Aggregations: Use aggregate_records for BI-style queries (grouping, counting, summing).
- Very specific: line 43
The Trigger: If you receive a ValueError or KeyError stating a field does not exist.
- Distinctive: line 45
Action: After finding the correct field, retry the operation with the updated field list.
- Distinctive: line 48
If you make a mistake or are asked to "undo" a change:
- Very specific: line 49
Locate: Use get_record (with show_chatter: true) on the target record to find the "Before Snapshot" you previously posted.
- Distinctive: line 50
Analyze: Verify the current record state.
- Very specific: line 51
Revert: Use write_record to re-apply the old values from the snapshot, providing a justification like "Reverting previous AI action: …
- Very specific: line 57
Mandate: NEVER simulate a transition with write_record on the state field.
- Very specific: line 59
Use execute_method with the real button (action_confirm, action_post, button_validate).
- Distinctive: line 71
X2many (One2many/Many2many): Use command tuples:
- Very specific: line 84
Operational Safety: NEVER attempt to modify your own res.users record to change your active company.
- Very specific: line 85
Correct Pattern: If you need to "switch" companies for a query, simply use the company_id domain filter.
- Distinctive: line 99
Delete system-critical records to "clean up" your view.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: Odoo Data Operations (CRUD)
This skill provides the agent with the expertise required to safely query and modify Odoo business data while maintaining a rigorous audit trail and reversibility context.
Core Mandates
1. The "Breadth vs. Depth" Search Paradigm (Golden Rule)
To prevent massive token-context inflation and optimize database execution, you must strictly follow this two-step data retrieval flow:
- Breadth (
search_records): ALWAYS usesearch_recordsfirst to discover data and locate specific IDs.- Safe Defaults: Leave
fieldsblank/empty to fetch our optimized, low-token "Breadth Layout" (ID, Display Name, State, Freshness, and the hierarchical "Belonging Relation"). - Exclusions: This tool strictly excludes heavy relational arrays or child lines to keep the response microscopic and scanable.
- Pagination: It returns a metadata envelope (
total_count,leadsmap of ID to display names) to assist your pagination.
- Safe Defaults: Leave
- Depth (
get_record/get_records): Once you find a target ID, useget_recordto fetch its 360-degree detailed "Record Dashboard".- Turn on flags like
show_lines(resolves full child rows for line tables, e.g., sales lines) andshow_chatter(fetches the last 5 Odoo Chatter comments) to get a complete picture in a single turn.
- Turn on flags like
2. Odoo Domain Syntax (Prefix-based)
Odoo uses a prefix-based polish notation for domain filters. You must follow this syntax when using search_records:
- AND (
&): Default behavior.['&', (A), (B)]means A and B. - OR (
|):['|', (A), (B)]means A or B. - NOT (
!):['!', (A)]means not A. - Example:
['&', ('is_company', '=', True), '|', ('city', '=', 'New York'), ('city', '=', 'London')]
3. Mandatory Justification
All state-changing operations (create_record, write_record, unlink_record) require a justification parameter.
- Requirement: This must be a clear, business-focused reason for the change.
- Persistence: This reason is permanently recorded in Odoo's Chatter (
mail.message) andir.logging.
4. Instance Awareness
Every CRUD tool supports an instance_alias parameter.
- Default: If omitted, the tool uses the current session's default instance.
- Cross-Instance: You can read from one environment and write to another by explicitly specifying different aliases in separate tool calls.
5. Efficient Data Retrieval
- Fields Overrides: If you need specific extra fields in
search_records, pass them explicitly in thefieldsarray. - Aggregations: Use
aggregate_recordsfor BI-style queries (grouping, counting, summing). This is much more context-efficient than reading thousands of records to perform local math.
6. Schema Strictness & Error Recovery
Odoo v18+ is strict about field lists.
- The Trigger: If you receive a
ValueErrororKeyErrorstating a field does not exist. - The Mandate: You must STOP and call
inspect_modelto verify the current live schema. Do NOT guess field names. - Action: After finding the correct field, retry the operation with the updated field list.
7. Agent-Driven Undo Workflow
If you make a mistake or are asked to "undo" a change:
- Locate: Use
get_record(withshow_chatter: true) on the target record to find the "Before Snapshot" you previously posted. - Analyze: Verify the current record state. Do not attempt a rollback if it violates Odoo's business logic (e.g., trying to revert an invoice that has since been paid).
- Revert: Use
write_recordto re-apply the old values from the snapshot, providing a justification like"Reverting previous AI action: [Original Reason]".
8. Workflow Transitions (execute_method)
Business documents move through their lifecycle via buttons, not field writes. Confirming a quotation, posting an invoice or validating a transfer runs server-side logic that creates journal entries, reserves stock and fires automations.
- Mandate: NEVER simulate a transition with
write_recordon thestatefield. Writingstate = 'sale'sets a string and skips every side effect, leaving the database inconsistent. Useexecute_methodwith the real button (action_confirm,action_post,button_validate). - Discovery: Find the button name with
get_view(look for<button type="object">in the form header) ortrace_ui_path. The tool verifies your method against the live views anyway and will refuse a name it cannot find. - ORM primitives are refused.
write,create,unlink,readandsearchare not callable here — that restriction exists soexecute_methodcannot bypass the snapshot and audit guards on the dedicated CRUD tools. Use those tools instead. - Inspect first: pass
dry_run: trueto see the target records and the state fields that will be captured, before committing.
7. Handling Relational Fields
- Many2one: Pass the integer ID of the target record.
- X2many (One2many/Many2many): Use command tuples:
(0, 0, {values}): Create a new linked record.(4, id): Link an existing record.(3, id): Unlink (but don't delete) a record.(2, id): Unlink and delete a record.(6, 0, [ids]): Replace all existing links with this list of IDs.
8. Multi-Company Logic (Golden Rule)
Odoo can be a multi-company environment, but many instances are single-company. Check get_environment (or the scope reported by switch_instance) for this instance's actual scope before applying company logic. When cross-company visibility applies, be precise:
- Implicit Context Injection: Brass-Monkey automatically appends
context: { 'allowed_company_ids': [...] }containing all of your authorized companies to the headers of every single tool execution. You do NOT need to switch active companies to see all your records. - Visibility: You can see records from all allowed companies (retrieved via
get_environmentand available programmatically in the rootactive_contextobject;multi_companythere tells you whether this instance has more than one). - Filtering: On multi-company instances, to query data for a specific company include
['company_id', '=', ID]in your domain — but only for models that actually have acompany_idfield. On single-company instances this filter is unnecessary, and on company-agnostic models (e.g.res.country, mostir.*) it raisesInvalid field 'company_id'. - Write / Relational Integrity: When creating or writing records, Odoo enforces strict relational isolation. Do not link records belonging to different companies (e.g., a Sales Order in Co A cannot point to a Warehouse in Co B). For company-scoped models, ensure a valid
company_idis supplied in values and relational targets match that company. - Operational Safety: NEVER attempt to modify your own
res.usersrecord to change your active company. This is considered System Vandalism. - Correct Pattern: If you need to "switch" companies for a query, simply use the
company_iddomain filter.
9. Orchestrated Translations (Forgiving Format)
Odoo supports multi-language fields (marked as translatable in inspect_model). Brass-Monkey handles them only when you set with_translations: true. Without the flag you read and write the user's language alone.
- Reading:
search_records,get_recordandget_recordsall acceptwith_translations: true. - The Matrix Format: A plain value means the field is identical in every active language. A list means the languages differ:
[{"value": "My Product", "langs": []}, {"value": "Mon Produit", "langs": ["fr_FR"]}]. The entry with emptylangsis the fallback for every language not listed. - The
translationsnote: Read results carry a note (translationsonsearch_records,_translationsonget_record/get_records) listing the active languages. If it holds anerror, the translations were not fetched, so the values are in the user's language only. Do not conclude that the languages match or differ. - Broadcast Writing: With
with_translations: true, a plain string written to a translatable field (e.g."name": "New Name") is applied to ALL active languages. Without the flag, only the user's language changes and the others keep their old text, with no warning. - Targeted Writing: With the flag, pass the list format to
write_record/create_recordto set specific languages. - Confirmation: A translated write returns
translations.languages_writtenper field. Requested languages that are not active appear underskipped_inactive.
10. System Vandalism Warning
You are an AI agent with high-level access. You must NEVER:
- Modify your own user record's
company_id,company_ids, orgroups_id. - Delete system-critical records to "clean up" your view.
- Bypass Odoo's business logic by directly modifying internal state fields (e.g.,
state,move_id) if a specialized method is available. - Enforcement: Attempting these actions will trigger tool-level safety blocks and may result in session termination.
11. Strict Tool Selection Protocol (Efficiency Mandate)
To prevent severe token/API overhead and extreme latency, you must adhere to the following selection matrix. Attempting to bypass these tool constraints will trigger active runtime advice warnings and is a violation of project architecture standards.
| Business Goal / Task | Mandatory Tool Selection | FORBIDDEN / High-Overhead Pattern |
| Discover, list, or filter records | search_records | Querying lists without limit/offset, or looping single-record searches. |
| Inspect a single known record ID | get_record (Depth mode) | CRITICAL FAILURE: Calling search_records with limit: 1 or filtering on an exact ID. get_record resolves sub-lines, relational display names, and chatter threads in one call. |
| Calculate sum, count, average, or groups | aggregate_records | CRITICAL FAILURE: Querying large pages with search_records (e.g., limit >= 100) and computing metrics locally. Always delegate calculations to the Odoo database via server-side SQL grouping. |
| Audit recent actions or changes | get_audit_log | Iteratively parsing records or the ir.logging model manually. |
| Fetch specific attachments/binaries | download_file | Attempting to pull large binary buffers through general database queries. |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

