Edit HTML fields by section
odoo_htmlWork on one html field (e.g. knowledge.article body, project.task description) by its parts, on the raw HTML. action='outline' lists the headings (unique anchors: the heading text, 'Text#2' when repeated) with each section's size; 'read' returns the field or one section; 'grep' finds the literal pattern across ids with the blocks around each hit; 'edit' applies exact {find, replace} edits (each find must match once, or nothing is written; replace_all:true renames a term everywhere in the field); 'replace_section' swaps the body under a heading for html (the body runs to the next heading of the same or a higher level, so its subsections go too). outline/read/grep return a version of the value; edit/replace_section REQUIRE it and write nothing if the field changed since. Writes need the model on the write whitelist. The answer carries the saved HTML of what changed, the new version and warning when Odoo's sanitizer altered it.
Html fields take markdown, converted the Odoo way: - [ ]/- [x] checklists, pipe tables, ##/### sections, --- separators. No inline style, invented classes or invented image URLs. edit takes raw HTML, not markdown: write the same markup, <ul class="o_checklist"> (<li class="o_checked"> when done), <table class="table table-bordered o_table">. When updating, fit new content into its section or list instead of appending it at the end, and keep what is there unless the user asked to remove it.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"model": "<model>",
"field": "<field>",
"action": "<action>"
},
"name": "odoo_html"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Record id (all actions but grep). | |
| ids | No | Record ids for grep. | |
| html | No | replace_section: the new body under the heading (the heading stays), raw HTML; markdown is converted. | |
| edits | No | edit: exact raw-HTML find/replace pairs, applied in order. | |
| field | Yes | An html field of the model. | |
| model | Yes | Odoo model technical name. | |
| action | Yes | ||
| context | No | grep: blocks before and after each hit. | |
| pattern | No | grep: literal text, case-insensitive. | |
| section | No | Section anchor from outline (read, replace_section). | |
| version | No | Required for edit/replace_section: the `version` from your last read. |