125 lines
7.0 KiB
XML
125 lines
7.0 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<!-- ============ Search Database ============ -->
|
|
<record id="ai_skill_information_retrieval_query" model="ai.skill">
|
|
<field name="name">Search Database</field>
|
|
<field name="sequence">10</field>
|
|
<field name="is_native_skill" eval="True"/>
|
|
<field name="description">Read data from any Odoo record: search, filter, aggregate and read field values.</field>
|
|
<field name="instructions">## Search Database
|
|
|
|
You can retrieve information from any Odoo record.
|
|
|
|
### Workflow
|
|
1. If you do not know the technical model name, call `get_models`.
|
|
2. Always call `get_fields` on a model before querying it: field names are technical identifiers, not labels.
|
|
3. Use `search` to read records, and `read_group` whenever the question is about totals, counts or averages — never read hundreds of records to compute a sum yourself.
|
|
4. When filtering on a date, compute the boundary with `compute_date`. The server runs in UTC while the user thinks in their own timezone; "today" means the user's today.
|
|
|
|
### Rules
|
|
- Never invent records, ids or field values. If a search returns nothing, say so and propose a broader search.
|
|
- Never guess a field name. If `get_fields` does not list it, it does not exist.
|
|
- Prefer a narrow domain over a broad one, and cap the number of fields you read to what the answer needs.
|
|
- When the question mentions a person, a company or a document by name, resolve it with a search first instead of asking the user for an id.
|
|
- Summarise the result in business terms. Do not paste raw ORM output.</field>
|
|
<field name="tool_ids" eval="[(6, 0, [
|
|
ref('ir_actions_server_get_models'),
|
|
ref('ir_actions_server_get_fields'),
|
|
ref('ir_actions_server_search'),
|
|
ref('ir_actions_server_read_group'),
|
|
ref('ir_actions_server_compute_date'),
|
|
ref('ir_actions_server_preview_records'),
|
|
])]"/>
|
|
</record>
|
|
|
|
<!-- ============ Shape View ============ -->
|
|
<record id="ai_skill_natural_language_query" model="ai.skill">
|
|
<field name="name">Shape View</field>
|
|
<field name="sequence">20</field>
|
|
<field name="is_native_skill" eval="True"/>
|
|
<field name="description">Navigate the user in the UI and shape the view: open a menu, filter, group, chart, pivot.</field>
|
|
<field name="instructions">## Shape View
|
|
|
|
You can navigate the user in the interface and interact with the current view.
|
|
Use it whenever the user asks to "see", "view", "show", "open", "filter", "group by", "chart", "compare" — even when no view type is mentioned.
|
|
|
|
### Workflow
|
|
1. Call `get_menus` to find the menu the user means. Pick the most specific match, not the first one.
|
|
2. If you are unsure which fields to group by, call `get_menu_details` (it lists the fields) or `compute_report_measures` for numeric measures.
|
|
3. Open the view with `open_menu_list`, `open_menu_kanban`, `open_menu_pivot` or `open_menu_graph`. Pass a domain when the user asked for a subset.
|
|
4. If the user is already looking at a screen and asks for a tweak, use `adjust_search` instead of opening a new view.
|
|
|
|
### Rules
|
|
- Always pass a real `menu_id` obtained from `get_menus`; never invent one.
|
|
- Group-bys must be plain field names, or `field:interval` for dates (day, week, month, quarter, year).
|
|
- Do not open a view and also describe the data at length: open the view, then add one short sentence about what it shows.
|
|
- If no menu matches, say which menus you found instead and ask which one the user meant.</field>
|
|
<field name="tool_ids" eval="[(6, 0, [
|
|
ref('ir_actions_server_get_models'),
|
|
ref('ir_actions_server_get_menus'),
|
|
ref('ir_actions_server_get_menu_details'),
|
|
ref('ir_actions_server_get_fields'),
|
|
ref('ir_actions_server_compute_date'),
|
|
ref('ir_actions_server_adjust_search'),
|
|
ref('ir_actions_server_open_menu_list'),
|
|
ref('ir_actions_server_open_menu_kanban'),
|
|
ref('ir_actions_server_open_menu_pivot'),
|
|
ref('ir_actions_server_open_menu_graph'),
|
|
ref('ir_actions_server_compute_report_measures'),
|
|
ref('ir_actions_server_run_view_action'),
|
|
])]"/>
|
|
</record>
|
|
|
|
<!-- ============ Update Records ============ -->
|
|
<record id="ai_skill_update_records" model="ai.skill">
|
|
<field name="name">Update Records</field>
|
|
<field name="sequence">30</field>
|
|
<field name="is_native_skill" eval="True"/>
|
|
<field name="description">Modify field values on existing records.</field>
|
|
<field name="instructions">## Update Records
|
|
|
|
You can update existing records.
|
|
|
|
### Rules
|
|
- Before updating, call `get_fields` on the model to confirm the exact technical field names and which ones are readonly.
|
|
- Build a precise domain that targets exactly the records the user meant. Updating "all records" is refused unless the user explicitly asked for it and the domain reflects it.
|
|
- Read the records first and show the user what will change when the request is ambiguous.
|
|
- Never write to computed or readonly fields, and never set a relational field with a raw id without checking the relation.
|
|
- The runtime shows a confirmation card before executing. Do not ask for confirmation in chat.
|
|
- After the update, state what changed in business terms, with the number of records touched.</field>
|
|
<field name="tool_ids" eval="[(6, 0, [
|
|
ref('ir_actions_server_get_models'),
|
|
ref('ir_actions_server_get_fields'),
|
|
ref('ir_actions_server_search'),
|
|
ref('ir_actions_server_compute_date'),
|
|
ref('ir_actions_server_update_records'),
|
|
])]"/>
|
|
</record>
|
|
|
|
<!-- ============ Create Records ============ -->
|
|
<record id="ai_skill_create_records" model="ai.skill">
|
|
<field name="name">Create Records</field>
|
|
<field name="sequence">40</field>
|
|
<field name="is_native_skill" eval="True"/>
|
|
<field name="description">Create new records from the conversation.</field>
|
|
<field name="instructions">## Create Records
|
|
|
|
You can create records.
|
|
|
|
### Rules
|
|
- Use `get_fields` to get the technical model name and the technical field names. Required fields must always be provided.
|
|
- Gather every mandatory value before creating. If a required value is missing and cannot be inferred from the conversation or a search, ask the user — do not invent a placeholder.
|
|
- Many2one values must be existing record ids. Resolve a name with `search` first.
|
|
- Provide a short `explanation` describing what will be created; it is shown on the confirmation card.
|
|
- Never create duplicates: search for an existing record matching the intent before creating a new one.
|
|
- After creation, tell the user what was created using display names, not ids.</field>
|
|
<field name="tool_ids" eval="[(6, 0, [
|
|
ref('ir_actions_server_get_models'),
|
|
ref('ir_actions_server_get_fields'),
|
|
ref('ir_actions_server_search'),
|
|
ref('ir_actions_server_compute_date'),
|
|
ref('ir_actions_server_create_records'),
|
|
])]"/>
|
|
</record>
|
|
</odoo>
|