mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-28 03:16:29 -06:00
[MIG] backport module attachment_zipped_download
This commit is contained in:
parent
a908fd3646
commit
1e7384bb19
@ -2,7 +2,7 @@
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
"name": "Attachment Zipped Download",
|
||||
"version": "16.0.1.0.1",
|
||||
"version": "12.0.1.0.1",
|
||||
"category": "Tools",
|
||||
"website": "https://github.com/OCA/knowledge",
|
||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||
|
@ -4,13 +4,14 @@
|
||||
import zipfile
|
||||
from io import BytesIO
|
||||
|
||||
from odoo import _, models
|
||||
from odoo import _, api, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class IrAttachment(models.Model):
|
||||
_inherit = "ir.attachment"
|
||||
|
||||
@api.multi
|
||||
def action_attachments_download(self):
|
||||
items = self.filtered(lambda x: x.type == "binary")
|
||||
if not items:
|
||||
|
@ -18,6 +18,7 @@ class TestAttachmentZippedDownload(odoo.tests.HttpCase):
|
||||
self.user = new_test_user(
|
||||
self.env,
|
||||
login="test-user",
|
||||
password="test-user",
|
||||
context=ctx,
|
||||
)
|
||||
test_1 = self._create_attachment(self.user, "test1.txt")
|
||||
@ -27,7 +28,7 @@ class TestAttachmentZippedDownload(odoo.tests.HttpCase):
|
||||
def _create_attachment(self, user, name):
|
||||
return (
|
||||
self.env["ir.attachment"]
|
||||
.with_user(user)
|
||||
.sudo(user)
|
||||
.create(
|
||||
{
|
||||
"name": name,
|
||||
|
Loading…
Reference in New Issue
Block a user