attachment
attachmentList, download, upload, or print files and PDF reports for Odoo records; uploads stay as drafts until the user approves the returned link.
Instructions
Files of records. action=list: a record's files (model, id) or files by name (query). action=download: a file by its id. action=report: a record's report as PDF; when the record has several, the first call lists them. Both return a temporary download_url: fetch it with any HTTP client (curl, wget, fetch). action=upload: attach a file to a record: short text in text; any file by the temporary upload_url you get back (PUT or multipart POST, e.g. curl -T file URL). Every change is a draft: it is saved when the user opens the returned link in Odoo and approves it. Give them the link.
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": {
"action": "<action>"
},
"name": "attachment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | download: the file's id. report and upload: the record's id. | |
| name | No | upload: file name with extension. | |
| text | No | upload of a small text file: its content. Without it, you get an upload_url to send the file to. | |
| draft | No | upload: true returns a link where the user approves it; false attaches now. | |
| limit | No | list: how many files. | |
| model | No | report and upload: the record's model, e.g. "sale.order". | |
| query | No | list: words in the file name. | |
| action | Yes | list files, download one, print a report, or upload a file. | |
| reason | No | upload with draft=false: why it is right without approval. | |
| report | No | report: which one, when the record has several. |