# How to add an attachment via proteus?

**URL:** https://discuss.tryton.org/t/how-to-add-an-attachment-via-proteus/4567
**Category:** Developer
**Created:** [August 26, 2021, 4:22pm UTC](https://discuss.tryton.org/t/how-to-add-an-attachment-via-proteus/4567 "2021-08-26T16:22:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mgcandia](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/m/45deac/32.png) [@mgcandia](https://discuss.tryton.org/u/mgcandia)
#### Post date: [August 26, 2021, 4:22pm UTC](https://discuss.tryton.org/t/how-to-add-an-attachment-via-proteus/4567/1 "2021-08-26T16:22:07Z")

</div>

hi, does anyone have an example?

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [August 26, 2021, 5:18pm UTC](https://discuss.tryton.org/t/how-to-add-an-attachment-via-proteus/4567/2 "2021-08-26T17:18:23Z")

</div>

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.

```auto
Attachment = Model.get('ir.attachmen')
attachment = Attachment()
attachment.resource = myrecord
attachment.data = b'…'
attachment.save()

```

---

<div class="post-metadata">

### Author: ![mgcandia](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/m/45deac/32.png) [@mgcandia](https://discuss.tryton.org/u/mgcandia)
#### Post date: [August 26, 2021, 6:26pm UTC](https://discuss.tryton.org/t/how-to-add-an-attachment-via-proteus/4567/3 "2021-08-26T18:26:23Z")

</div>

> [@ced](#):
>
> ttachment 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.

Thank you so much.  
it has worked excellent.
