list view In some occasions, we want to be able to download all edi documents so the user can upload them on a governemental platform. From the list view of all the invoice, it is now possible to selected as many invoice as we want, and with a newly added action download them into a zip. task-3122424 closes odoo/odoo#116854 X-original-commit: 5171f607e1fddde06b769ebb78d82548ad4dc84d Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
19 lines
798 B
Python
19 lines
798 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
from odoo import http
|
|
from odoo.http import request, content_disposition
|
|
|
|
|
|
class EdiDocumentDownloadController(http.Controller):
|
|
@http.route('/account_edi/download_edi_documents', type='http', auth='user')
|
|
def download_edi_documents(self, **args):
|
|
ids = list(map(int, request.httprequest.args.getlist('ids')))
|
|
content = request.env['account.move'].browse(ids)._create_zipped()
|
|
headers = [
|
|
('Content-Type', 'zip'),
|
|
('X-Content-Type-Options', 'nosniff'),
|
|
('Content-Length', len(content)),
|
|
('Content-Disposition', content_disposition('edi_documents.zip')),
|
|
]
|
|
return request.make_response(content, headers)
|