Adding attachments with proteus

41 views
Skip to first unread message

Clemens Hupka

unread,
Aug 10, 2016, 2:55:04 PM8/10/16
to tryton
Hello!

I try to add attachments using proteus (4.0) using the following code:
# p=Product.find(blabla)
                img = Attachment()
                with open(filename, "rb") as imageFile:
                    f = imageFile.read()
                    b = bytearray(f)
                img.type = 'data'
                img.name = filenamewithoutpath
                img.resource = p
                img.data = b
                img.save()



Cédric Krier

unread,
Aug 10, 2016, 4:40:04 PM8/10/16
to tryton
I guess it was answered by
http://www.tryton.org/~irclog/2016-08-10.log.html#t2016-08-10%2020:07

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
Reply all
Reply to author
Forward
0 new messages