Decode binary datas from Odoo attachments

Decode binary datas from Odoo attachments

Attachments in Odoo are stored in binary field named datas, you can access the field datas of ir.attachment model, and then:

message_bytes = base64.b64decode(datas)
message = message_bytes.decode(‘ISO-8859-1’)

then you can print message o write it to a file to have the original attachments.