Skip to content

Commit

Permalink
IMP: large file download
Browse files Browse the repository at this point in the history
  • Loading branch information
mboscolo committed Sep 25, 2024
1 parent 3a3c6be commit 820200d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plm_pack_and_go/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
##############################################################################
{
"name": "Plm Pack and Go",
"version": "16.0.2",
"version": "16.0.3",
"author": "OmniaSolutions",
"website": "https://odooplm.omniasolutions.website",
"category": "Manufacturing/Product Lifecycle Management (PLM)",
Expand Down
19 changes: 15 additions & 4 deletions plm_pack_and_go/wizard/pack_and_go_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,11 @@ def checkCreateFolder(path):
# Make archive, upload it and clean
#
outZipFile2 = shutil.make_archive(outZipFile, 'zip', outZipFile)
with open(outZipFile2, 'rb') as f:
fileContent = f.read()
if fileContent:
self.datas = base64.encodebytes(fileContent)
self.datas = self.get_steram(outZipFile2)
#with open(outZipFile2, 'rb') as f:
# fileContent = f.read()
# if fileContent:
# self.datas = base64.encodebytes(fileContent)
try:
shutil.rmtree(outZipFile)
except Exception as ex:
Expand All @@ -569,6 +570,16 @@ def checkCreateFolder(path):
'res_id': self.ids[0],
'type': 'ir.actions.act_window',
'domain': "[]"}

def get_steram(self, file_name):
stream=b''
with open(file_name, 'rb') as fr:
while True:
piece = fr.read(75232000)
if not piece:
break
stream+=base64.encodebytes(piece)
return stream

def getFileExtension(self, docBrws):
fileExtension = ''
Expand Down

0 comments on commit 820200d

Please sign in to comment.