Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3462 Zobrazení

In the recruitment module, when a job applicant submits the job form with file attachments, the odoobot attaches the files to the new applicant. How can I achieve the same thing via the Odoo External API?

version 13.0

Avatar
Zrušit
Autor Nejlepší odpověď
# I solved this problem this way:

from base64 import b64encode

data = file.read()

self.models.execute_kw(
db,
uid,
password,
"ir.attachment",
"create",
[
{
"res_model": model_name,
"res_id": model_id,
"type": "binary",
"name": name,
"display_name": name,
"mimetype": mimetype,
"datas": b64encode(data).decode("utf-8"),
},
],
)
Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
srp 24
4515
2
kvě 22
10232
0
bře 15
3252
1
říj 24
2544
3
úno 23
6842