Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
3443 Переглядів

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

Аватар
Відмінити
Автор Найкраща відповідь
# 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"),
},
],
)
Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
серп. 24
4497
2
трав. 22
10203
0
бер. 15
3239
1
жовт. 24
2533
3
лют. 23
6826