diff --git a/odex25_dms/dms/controllers/main.py b/odex25_dms/dms/controllers/main.py index f124b455b..16f3288b8 100644 --- a/odex25_dms/dms/controllers/main.py +++ b/odex25_dms/dms/controllers/main.py @@ -289,16 +289,31 @@ class ShareRoute(http.Controller): return response @http.route(['/document/zip'], type='http', auth='user') - def get_zip(self, file_ids, zip_name, token=None): - """route to get the zip file of the selection in the document's Kanban view (Document inspector). - :param file_ids: if of the files to zip. - :param zip_name: name of the zip file. + def get_zip(self, file_ids=None, zip_name=None, token=None, **kwargs): + """Route to get the zip file of the selection in the document's Kanban view. + + :param file_ids: IDs of the files to zip (either comma-separated or list format). + :param zip_name: Name of the zip file. + :param token: Optional token for file tracking. """ - ids_list = [int(x) for x in file_ids.split(',')] + if not file_ids: + # If file_ids is None, check for list-style query parameters + file_ids = request.httprequest.args.getlist('file_ids[]') + + if file_ids: + if isinstance(file_ids, list): # Case: file_ids[]=1262&file_ids[]=1256 + ids_list = [int(x) for x in file_ids] + else: # Case: file_ids=1262,1256,1261 + ids_list = [int(x) for x in file_ids.split(',')] + else: + ids_list = [] + env = request.env response = self._make_zip(zip_name, env['documents.document'].browse(ids_list)) + if token: response.set_cookie('fileToken', token) + return response @http.route(["/document/download/all//"], type='http', auth='public')