Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda

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
Buang
Penulis Jawaban Terbai
# 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
Buang
Post Terkait Replies Tampilan Aktivitas
1
Agu 24
4501
2
Mei 22
10207
0
Mar 15
3240
1
Okt 24
2539
3
Feb 23
6827