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
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
2599
Views
# 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"),
},
],
)
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Aug 24
|
759 | ||
|
2
May 22
|
5899 | ||
|
0
Mar 15
|
2262 | ||
|
1
Oct 24
|
309 | ||
|
3
Feb 23
|
5232 |