Commit d0835458 authored by Romain Courteaud's avatar Romain Courteaud

add the batch mode


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@204 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3196de68
...@@ -40,7 +40,7 @@ if not os.path.exists(log_directory_path ): ...@@ -40,7 +40,7 @@ if not os.path.exists(log_directory_path ):
""" """
this allows to import many edi files by the same time this allows to import many edi files by the same time
""" """
def importEdiFiles(self, REQUEST, delivery_mode, incoterm, order_type, segmentation_strategique, travel_duration): def importEdiFiles(self, REQUEST, delivery_mode, incoterm, order_type, segmentation_strategique, travel_duration, batch_mode=0):
files_list = os.listdir(import_directory_path) files_list = os.listdir(import_directory_path)
result = '' result = ''
...@@ -64,7 +64,7 @@ def importEdiFiles(self, REQUEST, delivery_mode, incoterm, order_type, segmentat ...@@ -64,7 +64,7 @@ def importEdiFiles(self, REQUEST, delivery_mode, incoterm, order_type, segmentat
import_file = FileUpload(form) import_file = FileUpload(form)
# import the file # import the file
resultTmp = self.SalesOrder_importEdi(import_file=import_file, delivery_mode=delivery_mode, incoterm=incoterm, order_type=order_type, segmentation_strategique=segmentation_strategique, travel_duration=travel_duration) resultTmp = self.SalesOrder_importEdi(import_file=import_file, delivery_mode=delivery_mode, incoterm=incoterm, order_type=order_type, segmentation_strategique=segmentation_strategique, travel_duration=travel_duration, batch_mode=1)
# test the result # test the result
if resultTmp == None: if resultTmp == None:
...@@ -83,5 +83,8 @@ def importEdiFiles(self, REQUEST, delivery_mode, incoterm, order_type, segmentat ...@@ -83,5 +83,8 @@ def importEdiFiles(self, REQUEST, delivery_mode, incoterm, order_type, segmentat
log_file.write(result) log_file.write(result)
log_file.close() log_file.close()
redirect_url = '%s?%s%i%s' % ( self.absolute_url()+'/'+'view', 'portal_status_message=',edi_files_number ,' Fichiers+EDI+imports.') if batch_mode:
REQUEST[ 'RESPONSE' ].redirect( redirect_url ) return None
else:
redirect_url = '%s?%s%i%s' % ( self.absolute_url()+'/'+'view', 'portal_status_message=',edi_files_number ,' Fichiers+EDI+imports.')
REQUEST[ 'RESPONSE' ].redirect( redirect_url )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment