From 2b993f9eaba03f2235941e41d2e38cc1c3fa9128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Tue, 2 Apr 2024 13:56:24 +0200 Subject: [PATCH] [MIG] attachment_zipped_download: Migration to 15.0 TT48578 --- attachment_zipped_download/README.rst | 12 ++--- attachment_zipped_download/__manifest__.py | 2 +- .../static/description/index.html | 8 +-- .../tests/test_attachment_zipped_download.py | 53 +++++++++++-------- .../test_ir_attachment_action_download.py | 16 ++++-- 5 files changed, 54 insertions(+), 37 deletions(-) diff --git a/attachment_zipped_download/README.rst b/attachment_zipped_download/README.rst index b60fce52..d4757b56 100644 --- a/attachment_zipped_download/README.rst +++ b/attachment_zipped_download/README.rst @@ -7,7 +7,7 @@ Attachment Zipped Download !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:f01e61d6df5d9f4d83daca5a9e41a5224a22debafe05c1e3ea55572df7587a51 + !! source digest: sha256:19f0b9a9a41dbb8fdaf0097414c256b4e02e0b963de604f19bf62f71b73bc482 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -17,13 +17,13 @@ Attachment Zipped Download :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github - :target: https://github.com/OCA/knowledge/tree/14.0/attachment_zipped_download + :target: https://github.com/OCA/knowledge/tree/15.0/attachment_zipped_download :alt: OCA/knowledge .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/knowledge-14-0/knowledge-14-0-attachment_zipped_download + :target: https://translation.odoo-community.org/projects/knowledge-15-0/knowledge-15-0-attachment_zipped_download :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=14.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=15.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -126,7 +126,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -163,6 +163,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/knowledge `_ project on GitHub. +This module is part of the `OCA/knowledge `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/attachment_zipped_download/__manifest__.py b/attachment_zipped_download/__manifest__.py index 77ec8a65..3294045b 100644 --- a/attachment_zipped_download/__manifest__.py +++ b/attachment_zipped_download/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Attachment Zipped Download", - "version": "14.0.2.0.0", + "version": "15.0.1.0.0", "category": "Tools", "website": "https://github.com/OCA/knowledge", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/attachment_zipped_download/static/description/index.html b/attachment_zipped_download/static/description/index.html index 2dd9dc9b..38255082 100644 --- a/attachment_zipped_download/static/description/index.html +++ b/attachment_zipped_download/static/description/index.html @@ -367,9 +367,9 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:f01e61d6df5d9f4d83daca5a9e41a5224a22debafe05c1e3ea55572df7587a51 +!! source digest: sha256:19f0b9a9a41dbb8fdaf0097414c256b4e02e0b963de604f19bf62f71b73bc482 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/knowledge Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/knowledge Translate me on Weblate Try me on Runboat

This module allows downloading multiple attachments as a zip file.

This also provide a helper class IrAttachmentActionDownloadMixin to be used by developer to add action method on models.

@@ -472,7 +472,7 @@ class IrAttachment(models.Model):

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -502,7 +502,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/knowledge project on GitHub.

+

This module is part of the OCA/knowledge project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/attachment_zipped_download/tests/test_attachment_zipped_download.py b/attachment_zipped_download/tests/test_attachment_zipped_download.py index e4e1281a..b44e21eb 100644 --- a/attachment_zipped_download/tests/test_attachment_zipped_download.py +++ b/attachment_zipped_download/tests/test_attachment_zipped_download.py @@ -4,7 +4,7 @@ import base64 from unittest import TestCase from odoo.exceptions import AccessError -from odoo.tests import HttpCase, SavepointCase, new_test_user +from odoo.tests import HttpCase, TransactionCase, new_test_user class TestAttachmentZippedDownloadBase(TestCase): @@ -25,23 +25,27 @@ class TestAttachmentZippedDownloadBase(TestCase): class TestAttachmentZippedDownload(HttpCase, TestAttachmentZippedDownloadBase): - def setUp(self): - super().setUp() - ctx = { - "mail_create_nolog": True, - "mail_create_nosubscribe": True, - "mail_notrack": True, - "no_reset_password": True, - } - self.user = new_test_user( - self.env, + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env( + context=dict( + cls.env.context, + mail_create_nolog=True, + mail_create_nosubscribe=True, + mail_notrack=True, + no_reset_password=True, + tracking_disable=True, + ) + ) + cls.user = new_test_user( + cls.env, login="test-user", password="test-user", - context=ctx, ) - test_1 = self._create_attachment(self.env, self.user, "test1.txt") - test_2 = self._create_attachment(self.env, self.user, "test2.txt") - self.attachments = test_1 + test_2 + test_1 = cls._create_attachment(cls.env, cls.user, "test1.txt") + test_2 = cls._create_attachment(cls.env, cls.user, "test2.txt") + cls.attachments = test_1 + test_2 def test_action_attachments_download(self): self.authenticate("test-user", "test-user") @@ -50,22 +54,25 @@ class TestAttachmentZippedDownload(HttpCase, TestAttachmentZippedDownloadBase): self.assertEqual(response.status_code, 200) -class TestAttachmentZipped(SavepointCase, TestAttachmentZippedDownloadBase): +class TestAttachmentZipped(TransactionCase, TestAttachmentZippedDownloadBase): @classmethod def setUpClass(cls): super().setUpClass() - ctx = { - "mail_create_nolog": True, - "mail_create_nosubscribe": True, - "mail_notrack": True, - "no_reset_password": True, - } + cls.env = cls.env( + context=dict( + cls.env.context, + mail_create_nolog=True, + mail_create_nosubscribe=True, + mail_notrack=True, + no_reset_password=True, + tracking_disable=True, + ) + ) cls.user = new_test_user( cls.env, login="test-user", password="test-user", groups="base.group_user,base.group_partner_manager", - context=ctx, ) test_1 = cls._create_attachment(cls.env, cls.user, "test1.txt") test_2 = cls._create_attachment(cls.env, cls.user, "test2.txt") diff --git a/attachment_zipped_download/tests/test_ir_attachment_action_download.py b/attachment_zipped_download/tests/test_ir_attachment_action_download.py index 1a595359..10e17518 100644 --- a/attachment_zipped_download/tests/test_ir_attachment_action_download.py +++ b/attachment_zipped_download/tests/test_ir_attachment_action_download.py @@ -3,15 +3,25 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo_test_helper import FakeModelLoader -from odoo.tests import SavepointCase +from odoo.tests import TransactionCase from .test_attachment_zipped_download import TestAttachmentZippedDownloadBase -class TestMixin(SavepointCase, TestAttachmentZippedDownloadBase): +class TestMixin(TransactionCase, TestAttachmentZippedDownloadBase): @classmethod def setUpClass(cls): - super(TestMixin, cls).setUpClass() + super().setUpClass() + cls.env = cls.env( + context=dict( + cls.env.context, + mail_create_nolog=True, + mail_create_nosubscribe=True, + mail_notrack=True, + no_reset_password=True, + tracking_disable=True, + ) + ) cls.loader = FakeModelLoader(cls.env, cls.__module__) cls.addClassCleanup(cls.loader.restore_registry) cls.loader.backup_registry()