Skip to Content
Menu
This question has been flagged
2623 Views
Hi,

I'm using odoo 12,

I want to upload a single file .pdf through the API. Can you please explain to me how to do this in the most simple way without having any module attachments, if that's possible? If it's not possible then let me know a way that's possible to do that. I have the following code:



this.getBase64(this.state.selectedFile).then((data) => {
const param = [
[
{
res_model: "account_invoice",
res_name : this.state.selectedFile.name,
res_id: 95,
name: this.state.selectedFile.name,
datas: data,
type: "binary",
res_field : "pdf"
},
],
];

odoo.execute_kw("ir.attachment", "create", param);
});
});
Avatar
Discard