Attachement with proteus

I have a strange behavior that i do not understand, i probably miss something

i create an attachment like that :

att=Model.get(‘ir.attachment’)
the_att=att()
the_att.type=‘data’
with open(‘/home/user/image428.png’, ‘rb’) as f:
    the_att.data = f.read()
the_att.name=“icone.png”
Party=Model.get('party.party');
party,=Party.find([('code','=','party_code')])
the_att.resource=party
the_att.save()

it works, the file created in /var/lib/tryton/tryton/…. is plainly functional, if i send it as attachement in mail the user get the real file but in my tryton sao i only have a 4 octet broken file in my party view and the same in the email archives.

do i missed something ?

i debug the thing and i do not know hao to solve the problem (if there is a manner to solve it). I create an attachment with sao and one with protheus.

the 2 have the same shape in ir_attachment

21 | | 2025-12-15 …| 1 | | | a3e2458dc….a8 | | 331.png | party.party,25561 | data | |
22 | | 2025-12-15… | 1 | | | 9f881…3deb18 | | icone23.png | party.party,25561 | data | |

they both exists in /var/lib/tryton/tryton/…

the only difference is the owner one is tryton, the second the user.. rights of file -rw-r–r– sould let tryton at least read it but no.

and when i change the owner to tryton, the file becomes available for tryton.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.