Hello,
I am struggling to add an attachment to a mail message that I create through the XMLRPC API for Odoo 14.
I get the error message... argument should be a bytes-like object or ASCII string, not \'Binary\'
But when I print the type of my argument, it says class 'bytes'
What am I missing ?
Code follows...
with open("c:/users/lwolf/pictures/WinUpdate1.png", "rb") as image_file:
imageBase64 = base64.b64encode(image_file.read())
print("The type of imageBase64 is ", type(imageBase64))
models.execute_kw(db, uid, password,
'ir.attachment',
'create',
[{
'res_model' : 'mail.message',
'name' : 'WinUpdate Image',
'res_id' : id,
'type' : 'binary',
'mimetype' : 'image/png',
'store_fname' : 'WinUpdate1.png',
'datas' : imageBase64
}]
)
Hello Leonard, i am facing similar problem. have you found a fix?
Hello Bogdan,
Sorry to say, I have not been able to resolve this. I've given up for now until someone can give me advice.