[MIG] attachment_zipped_download: Migration to 15.0

TT48578
This commit is contained in:
Víctor Martínez 2024-04-02 13:56:24 +02:00
parent 039c83207e
commit 2b993f9eab
5 changed files with 54 additions and 37 deletions

View File

@ -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 <https://github.com/OCA/knowledge/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 <https://github.com/OCA/knowledge/issues/new?body=module:%20attachment_zipped_download%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/knowledge/issues/new?body=module:%20attachment_zipped_download%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
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 <https://github.com/OCA/knowledge/tree/14.0/attachment_zipped_download>`_ project on GitHub.
This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/15.0/attachment_zipped_download>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -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)",

View File

@ -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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/knowledge/tree/14.0/attachment_zipped_download"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/knowledge-14-0/knowledge-14-0-attachment_zipped_download"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/knowledge&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/knowledge/tree/15.0/attachment_zipped_download"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/knowledge-15-0/knowledge-15-0-attachment_zipped_download"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/knowledge&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows downloading multiple attachments as a zip file.</p>
<p>This also provide a helper class <cite>IrAttachmentActionDownloadMixin</cite>
to be used by developer to add action method on models.</p>
@ -472,7 +472,7 @@ class IrAttachment(models.Model):
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/knowledge/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20attachment_zipped_download%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20attachment_zipped_download%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@ -502,7 +502,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/14.0/attachment_zipped_download">OCA/knowledge</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/15.0/attachment_zipped_download">OCA/knowledge</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@ -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")

View File

@ -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()