跳至内容
菜单
此问题已终结

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"),
},
],
)
形象
丢弃
相关帖文 回复 查看 活动
1
8月 24
4522
2
5月 22
10238
0
3月 15
3252
1
10月 24
2544
3
2月 23
6843