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.
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.