upgrade-attachment-datas (U2018)#

ir.attachment datas, removed in Odoo 20.0.

Applies to Odoo 20.0 and later.

What it does#

Reports the "datas" key in values and the .datas attribute.

Why is this bad?#

Odoo 20.0 removed ir.attachment.datas: written values are dropped with a warning, so the attachment is created empty, and reading it fails. Use raw (bytes).

Fix safety#

Safe for "datas": base64.b64encode(content), which becomes "raw": content. Others need a person (att.datas → att.raw.to_base64() where base64 is really needed).