Skip to content

Commit

Permalink
IMP: manage large zip file
Browse files Browse the repository at this point in the history
  • Loading branch information
mboscolo committed Sep 25, 2024
1 parent 89dc3b9 commit 838830f
Show file tree
Hide file tree
Showing 2 changed files with 13 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": "17.0.0.1",
"version": "17.0.0.2",
"author": "OmniaSolutions",
"website": "https://odooplm.omniasolutions.website",
"category": "Manufacturing/Product Lifecycle Management (PLM)",
Expand Down
16 changes: 12 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,8 @@ 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)
#
try:
shutil.rmtree(outZipFile)
except Exception as ex:
Expand All @@ -570,6 +568,16 @@ def checkCreateFolder(path):
'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 = ''
datas_fname = docBrws.name
Expand Down

0 comments on commit 838830f

Please sign in to comment.