hi, does anyone have an example?
Attachment is a model like any other so you create them by instantiate and save one.
The only point is to set the resource field with the record it is attached.
Attachment = Model.get('ir.attachmen')
attachment = Attachment()
attachment.resource = myrecord
attachment.data = b'…'
attachment.save()
1 Like
Thank you so much.
it has worked excellent.