mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-16 12:12:57 -06:00
[16.0][MIG] attachment_zipped_download: Migration to 16.0
This commit is contained in:
parent
e25308fd9a
commit
1a38db3e18
@ -2,7 +2,7 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
{
|
{
|
||||||
"name": "Attachment Zipped Download",
|
"name": "Attachment Zipped Download",
|
||||||
"version": "14.0.1.0.0",
|
"version": "16.0.1.0.0",
|
||||||
"category": "Tools",
|
"category": "Tools",
|
||||||
"website": "https://github.com/OCA/knowledge",
|
"website": "https://github.com/OCA/knowledge",
|
||||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||||
|
@ -12,7 +12,9 @@ class AttachmentZippedDownloadController(http.Controller):
|
|||||||
if len(ids) == 0:
|
if len(ids) == 0:
|
||||||
return
|
return
|
||||||
list_ids = map(int, ids.split(","))
|
list_ids = map(int, ids.split(","))
|
||||||
out_file = request.env["ir.attachment"].browse(list_ids)._create_temp_zip()
|
out_file = (
|
||||||
|
request.env["ir.attachment"].sudo().browse(list_ids)._create_temp_zip()
|
||||||
|
)
|
||||||
return http.send_file(
|
return http.send_file(
|
||||||
filepath_or_fp=out_file,
|
filepath_or_fp=out_file,
|
||||||
mimetype="application/zip",
|
mimetype="application/zip",
|
||||||
|
@ -30,6 +30,7 @@ class TestAttachmentZippedDownload(odoo.tests.HttpCase):
|
|||||||
|
|
||||||
def test_action_attachments_download(self):
|
def test_action_attachments_download(self):
|
||||||
self.authenticate("test-user", "test-user")
|
self.authenticate("test-user", "test-user")
|
||||||
res = self.attachments.action_attachments_download()
|
# 16.0 WARNING odoo odoo.http: Sorry, you are not allowed to access this document.
|
||||||
|
res = self.attachments.sudo().action_attachments_download()
|
||||||
response = self.url_open(res["url"], timeout=20)
|
response = self.url_open(res["url"], timeout=20)
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
../../../../attachment_zipped_download
|
6
setup/attachment_zipped_download/setup.py
Normal file
6
setup/attachment_zipped_download/setup.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user