0

I'm working on a custom module where I first need to generate a zip file (containing 3-4 CSV files) on the disk. Once it is done I want to upload that zip file into Odoo sales module as an attachment (ir.attachment) inside the related sales order. This way user can anytime download that zip file to view the archived files.

I'm able to generate zip file successfully on the disk, but after that, I'm not able to find how to attach that zip file (as binary) in the ir.attachment model. Can anyone please help me here?

Parul R
  • 1
  • 1
  • What have you tried so far? – CZoellner Aug 21 '18 at 15:00
  • 1
    I've tried to convert zip files to binary and then create the new record with self.env['ir.attachment'].create method. This is attaching the new file in the related record but when I download that file its showing corrupted and not in valid zip format. – Parul R Aug 22 '18 at 06:33
  • Sounds good, but could you share the code of that creation part? – CZoellner Aug 22 '18 at 12:25
  • I've found an alternate way to satisfy our needs without attaching the zip file. Hence, I believe this question does not have merit now. Thanks @CZoellner for your help. – Parul R Aug 23 '18 at 07:41

0 Answers0