odoo_website_add_snippet
Insert a website snippet into an Odoo HTML field at a chosen position with optional text, attribute, or image substitutions.
Instructions
Insert a snippet into a target HTML field. Fetches the snippet template from ir.ui.view by key, extracts its root HTML element, applies optional substitutions (text/attr/src changes before insertion), and places it at the specified position relative to an anchor. Positions: 'end' (after last element), 'begin' (before first), 'after' (after anchor_xpath), 'before' (before anchor_xpath), 'replace' (replace anchor_xpath). Substitutions format: {'relative_xpath': value} for text; {'relative_xpath/@attr': value} for attribute; {'relative_xpath/@style:background-image': 'url(...)'} for CSS property; {'relative_xpath/@src': 'https://...'} for image URL.
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>",
"res_id": "<res_id>",
"field_name": "<field_name>",
"snippet_key": "<snippet_key>"
},
"name": "odoo_website_add_snippet"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lang | No | Lang context for write (default: en_US) | |
| model | Yes | ||
| res_id | Yes | ||
| dry_run | No | ||
| position | No | end | |
| connection | No | default | |
| field_name | Yes | ||
| snippet_key | Yes | Snippet template key (e.g. 'website.s_text_block', 'website.s_cta_card') | |
| anchor_xpath | No | Required for position in (after, before, replace). Xpath to the anchor element in target. | |
| substitutions | No | Map of relative xpath → value for pre-insertion customisation. |